本文介绍了每天8:00、12:30、17:00运行Gmail Google Apps脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我每天需要运行三次Google Apps脚本:8:00、12:30、17:00.
I need to run a Google Apps script three times a day: at 8:00, 12:30, 17:00.
如何执行此操作?
我已经看过Triggers,更具体地说是Time driven:
I have already looked at Triggers, and more specifically Time driven:
-
小时计时器,但此处未适应Every hour,Every 2 hours,Every 4 hours
日间计时器,但是8am to 9am不太精确,我希望更精确一些,而且12:30也不可能
Day timer, but then 8am to 9am is not very precise, I would prefer something more precise, and also 12:30 is not possible
特定时间,但是YYYY-MM-DD HH:MM不适合每天运行
Specific time, but then YYYY-MM-DD HH:MM is not adapted to run it daily
From calendar触发器似乎也没有适应.
From calendar triggers does not seem adapted either.
推荐答案使用 nearMinute()和atHour():
const createTrigger = ([hour, minute])=> ScriptApp.newTrigger("myFunction") .timeBased() .atHour(hour) .nearMinute(minute) .everyDays(1) .create(); [[8,0],[12,30],[17,0]].forEach(createTrigger)更多推荐
每天8:00、12:30、17:00运行Gmail Google Apps脚本
发布评论