I would like a google script to run every time a file is added to a specific folder. Can this be done? Currently, I have a trigger that causes the script to run every minute, however this is not always fast enough.
Run a Google Script when a file is added to a folder
Asked Answered
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!");
//
}
}
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. –
Retraction
© 2022 - 2024 — McMap. All rights reserved.
Changes
resource? – Greeson