admin管理员组文章数量:1290957
I am trying to make a triger to fire a function on a specific date in the future. I am using the .atDate method, but I want to use a cell from the sheet as a reference.
My code is:
`function createTimeTrigger() {
ScriptApp.newTrigger("AdditionalSlots")
.timeBased()
.atDate(2025, 02, 12)
.create();
}`
... and it works fine. My problem is that I wand to set the date (2025, 02, 12), from a cell of the sheet and after that to run the code. Is there a solution to grab the date from the cell and used it in the code? Thank you!
I am trying to make a triger to fire a function on a specific date in the future. I am using the .atDate method, but I want to use a cell from the sheet as a reference.
My code is:
`function createTimeTrigger() {
ScriptApp.newTrigger("AdditionalSlots")
.timeBased()
.atDate(2025, 02, 12)
.create();
}`
... and it works fine. My problem is that I wand to set the date (2025, 02, 12), from a cell of the sheet and after that to run the code. Is there a solution to grab the date from the cell and used it in the code? Thank you!
Share Improve this question edited Feb 14 at 20:16 leylou 5641 silver badge10 bronze badges asked Feb 13 at 15:41 Konstantinos RizopoulosKonstantinos Rizopoulos 31 silver badge1 bronze badge1 Answer
Reset to default 1You may try:
function createTimeTrigger() {
ScriptApp.newTrigger("AdditionalSlots")
.timeBased()
.at(SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange("A1").getValue())
.create();
}
This gets the date in A1
and creates a trigger for that period.
REFERENCE
- at(date)
本文标签: dateTime trigger atDate using a cell as a referenceStack Overflow
版权声明:本文标题:date - Time trigger .atDate using a cell as a reference - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741519918a2383118.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论