创建自定义触发器谷歌应用脚​​本

时间:2017-05-11 18:31:54

标签: google-apps-script

如何创建自定义运行触发器以执行函数以在下午6点运行备用星期一。

function createCustomTrigger() {
  ScriptApp.newTrigger('myFunction')
      .timeBased()
      .onWeekDay(ScriptApp.WeekDay.MONDAY)
      .atHour(6)
      .create();
}

1 个答案:

答案 0 :(得分:0)

使用everyWeeks() method

ScriptApp.newTrigger('myFunction')
    .timeBased()
    .everyWeeks(2)
    .onWeekDay(ScriptApp.Weekday.MONDAY)
    .atHour(6)
    .create();