1
votes

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.

I created a function that is, when the testfile.csv file is uploaded to Folder1, it will move to Folder2. Folder1 will become empty. 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. The test.csv file is uploaded once a day and it can be anytime of the day--no specific time or range.

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.

Hope someone can enlighten me. Thank you!

1
Pardon if I failed to understand your goal. But why you don't want a time triggered script? It can check the folder, say, every 60 seconds and to run if a new file was found inside the folder. As far as I know Drive has no "onLoad()" trigger. - Yuri Khristich
There was an instance wherein we received an error like the user account is simultaneously running script or like too many times (not the exact error message though). I was thinking this is because my other Apps Script Projects are also set to time based triggers. - cgstats
I'm not even sure if that was the cause of the error though. but, if time-based trigger should not be an issue while my other Script Projects are time-based triggers can be kept running then I think I can use the 60sec time trigger. I just really need an input from you guys who really have the knowledge about this. btw, thanks Yuri. - cgstats

1 Answers

2
votes

You'll need Drive API push notifications but sadly it can't trigger a google apps script. See a more detailed explanation here.

Your best solution is a time triggered script as what Yuri mentioned in the comments above.