我想在 Google ScriptApp 中創建一個觸發器,它在周一到周五的上午 9 點到下午 5 點之間觸發,這可能嗎?
uj5u.com熱心網友回復:
我不確定如果不為您希望函式運行的一天中的每個小時手動創建觸發器,是否可行。
如果當前時間不是作業日晚上 9 點到 5 點之間,為什么不使用每小時觸發,而是自動退出觸發功能?
function triggeredFunction() {
const currentDate= new Date();
if(currentDate.getDay() < 1 || currentDate.getDay() > 5 || currentDate.getHours() < 9 || currentDate.getHours() > 17)
return;
// your code
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/367951.html
標籤:谷歌应用程序脚本
