0

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.

TheMaster
  • 45,448
  • 6
  • 62
  • 85
Hannah
  • 1
  • 1

2 Answers2

0

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

TheMaster
  • 45,448
  • 6
  • 62
  • 85
0

Delete all Triggers

function stopAllTrigger() {
  ScriptApp.getProjectTriggers().forEach(t => ScriptApp.deleteTrigger(t));
}
Cooper
  • 59,616
  • 6
  • 23
  • 54