简体   繁体   English

Google Apps脚本触发器每月的第一个星期四

[英]Google Apps Script Trigger 1st thursday of every month

I am trying to create a trigger to run on the 1st Thursday of every month but cant seem to get this to work correctly. 我正在尝试创建一个触发器,使其在每个月的第一个星期四运行,但似乎无法使其正常工作。 I know how to create the weekday trigger: 我知道如何创建工作日触发器:

ScriptApp.newTrigger('myFunction')
  .timeBased()
  .onWeekDay(ScriptApp.WeekDay.THURSDAY)
  .atHour(9)
  .create();

But I don't know how to specify that this needs to be the first Thursday of every month. 但是我不知道如何指定这必须是每个月的第一个星期四。 I would assume I can use an IF statement and say if the date is less than 7 it should run, but that seems overly complicated. 我假设我可以使用IF语句,并说如果日期小于7,则应运行该语句,但这似乎过于复杂。 Any help is appreciated! 任何帮助表示赞赏!

@Ben, nested time trigger in Class ClockTriggerBuilder cannot be done and is only fixed in some time trigger. @Ben,类ClockTriggerBuilder中的嵌套时间触发器无法完成,只能在某个时间触发器中解决。 Here is the link for more details . 这是更多详细信息的链接。 You can find other triggers for your apps Script like snippet . 您可以为您的应用程序脚本snippet找到其他触发器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在每个月末设置应用程序脚本触发 email Google 表单? - How do I set up an apps script trigger to email a Google form at the end of every month? 将 Google Sheet 数据合并到 Google Doc 模板的 Google Apps 脚本在第一行数据之后没有迭代 - Google Apps Script of merging Google Sheet data to Google Doc template is not iterating after the 1st row of data 使用唯一标识符通过Google Apps脚本根据另一个工作表中的数据更新第一工作表中的数据 - Update data in 1st sheet based on data from another sheet with google apps script via unique identifier Google Apps 脚本触发器 - Google Apps Script Trigger 每 2 个月运行一次的 Google Apps 脚本触发器不起作用 - Google Apps Script trigger to run every 2 months is not working 如何使用 Google Apps 脚本遍历范围,获取第一个 Col 数据并继续迭代以形成 html 表? - How to iterate through a range, get 1st Col data once and continue iterating to form an html table, using Google Apps Script? 每周四打开 Google 表单 - Open Google Form every Thursday 在 Google Apps 脚本中触发 importHTML - Trigger importHTML in Google Apps Script Google Apps脚本触发器未运行 - Google Apps Script Trigger not running 使用Google Apps脚本触发插件 - Trigger Addon with Google Apps Script
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM