每天 8:00、12:30、17:00 运行 Gmail Google Apps 脚本

编程入门 行业动态 更新时间:2024-10-19 00:27:51
本文介绍了每天 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 脚本

本文发布于:2023-11-27 04:09:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636531.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   Apps   Google   Gmail

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!