本文介绍了每天 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,更具体地说时间驱动:
I have already looked at Triggers, and more specifically Time driven:
Hour timer,但是Every hour、每2小时、每4小时这里没有适配
白天计时器,但是早上 8 点到早上 9 点 不是很精确,我希望更精确一些,而且 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 脚本
发布评论