I seem to be running up against some kind of unspecified limit with my G Suite account while using Google Apps scripts, but I'm not sure what the limit is and/or how I should adjust my workflow.
I have a G Suite Business account.
I have about 45 relatively simple projects in my "G Suite Developer Hub".
Each project has just one little script with a single function, set with a time-based trigger to run daily between 2:00 am and 3:00 am.
Each project exists just to move files from one folder to another, once a day. Each project exists for a different pair of folders.
Here's the template for the one little file in each project, named Code.gs
.
var source_folder = DriveApp.getFolderById("xxxxxxxxsourceFolderIDxxxxxxxx")
var dest_folder = DriveApp.getFolderById("xxxxxxxxdestinationFolderIDxxxxxxxx")
function moveFiles() {
var files = source_folder.getFiles();
while (files.hasNext()) {
var file = files.next();
dest_folder.addFile(file);
source_folder.removeFile(file);
}
}
Most of the triggers seem to work just fine, but I was recently notified of trigger failures for two of them:
Start | Function | Error Message | Trigger | End
6/5/19 2:43 AM | moveFiles | Limit Exceeded: Drive. (line 13, file "Code") | time-based | 6/5/19 2:43 AM
Line 13 is just: source_folder.removeFile(file);
Why is this happening, and how can I make sure that I don't suffer this limitation?