Is there a way to end a trigger after a month or two in Google App Script? Like for example, I want the trigger to occur on a daily basis just for one month and discontinue after the end of the month.
CodePudding user response:
Check the date in trigger function daily and if current date is greater than first day of next month and if so, delete the trigger using trigger unique id
CodePudding user response:
Delete all Triggers
function stopAllTrigger() {
ScriptApp.getProjectTriggers().forEach(t => ScriptApp.deleteTrigger(t));
}