I have a google apps script that is linked to a google sheets document. I want to run the script at the top of each hour, ie, exactly 1:00:00 pm, 2:00:00 pm, 3:00:00 pm etc.
I have set up hourly triggers from within the "Manage Project's Triggers" settings. However this will choose a random time during the hour to run the script. For example, it may run at 1:15pm or 1:56pm. It still runs once an hour, but I need it right when the hour changes.
Is it possible to set up a trigger from within the script's code such that it will run as I want, rather than a random time during each hour?
Thanks in advance!
Yes. Try the nearMinute
option from the ClockTriggerBuilder
method as documented here.
While it still wouldn't be 'exact', as indicated, it should be plus or minus 15 minutes.
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With