简体   繁体   English

Google Apps 脚本触发器

[英]Google Apps Script Trigger

I'm just new to everything about this.我对这一切都很陌生。 I created an Apps Script Project just by inside a Google Drive folder, so I did not use a Spreadsheet to create the project.我只是在 Google Drive 文件夹中创建了一个 Apps 脚本项目,所以我没有使用电子表格来创建该项目。

I created a function that is, when the testfile.csv file is uploaded to Folder1, it will move to Folder2.我创建了一个函数,当 testfile.csv 文件上传到 Folder1 时,它会移动到 Folder2。 Folder1 will become empty. Folder1 将变为空。 This function is working fine.此功能运行良好。

However, I would like the function/script to automatically run when a new testfile.csv file is uploaded again to the Folder1.但是,我希望函数/脚本在新的 testfile.csv 文件再次上传到 Folder1 时自动运行。 The test.csv file is uploaded once a day and it can be anytime of the day--no specific time or range. test.csv 文件每天上传一次,可以是一天中的任何时间——没有特定的时间或范围。

I'm afraid the "Add Trigger" built-in to the Apps Script won't work in our situation as it will keep on running depends on the set time.恐怕 Apps 脚本中内置的“添加触发器”在我们的情况下不起作用,因为它会根据设置的时间继续运行。

Hope someone can enlighten me.希望有人能给我解惑。 Thank you!谢谢!

You'll need Drive API push notifications but sadly it can't trigger a google apps script.您将需要Drive API 推送通知,但遗憾的是它无法触发谷歌应用程序脚本。 See a more detailed explanation here .在此处查看更详细的解释。

Your best solution is a time triggered script as what Yuri mentioned in the comments above.您最好的解决方案是时间触发脚本,正如 Yuri 在上面的评论中提到的那样。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM