将文件添加到文件夹时运行 Google 脚本

2024-03-22

我希望每次将文件添加到特定文件夹时运行谷歌脚本。这可以做到吗?目前,我有一个触发器使脚本每分钟运行一次,但这并不总是足够快。


    function mainFunction(){
  const folderID = 'folderID'; //provide here the ID of the folder
  const newCounter = countFiles(folderID);
  const runCode = checkProperty(folderID, newCounter);
  
  if(runCode){
   // here execute your main code
   // 
    console.log("I am executed!");
   //
  }
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

将文件添加到文件夹时运行 Google 脚本 的相关文章

随机推荐