AppsScriptPulse

Executing Function with Minutes timer in Specific Times using Google Apps Script [and tips on creating triggers in V8]

This is a sample script for executing a function with the minutes timer in the specific times using Google Apps Script. For example, when this sample script is used, the following situation can be achieved: Execute a function every 10 minutes only in 09:00 – 12:00 and 15:00 – 18:00 for the weekday.

A clever bit of coding from Kanshi Tanaike for running a Google Apps Script on a defined schedule. The part I found particularly interesting was the solution for programmatically setting triggers in the V8 runtime:

This sample script used Web Apps. Because when v8 runtime is used, when the trigger is set from the function executing by a trigger, the trigger is disabled. This is the recognized bug. But unfortunately, this has still not been resolved. (September 21, 2021) But, when the trigger is installed by Web Apps, no issue occurs. So, please deploy Web Apps.

For the sample code and explanation visit the source link.

Source: Executing Function with Minutes timer in Specific Times using Google Apps Script

Leave a Reply

Your email address will not be published. Required fields are marked *