Whenever I run the following function
function getDatabases(){
var files = DriveApp.getFilesByType(MimeType.GOOGLE_SHEETS);
var amount = 0;
while (files.hasNext()){
if((files.next().getName()).indexOf("Database") > -1){
amount++;
}
}
return amount;
}
I get this error:
We're sorry, a server error occurred. Please wait a bit and try again.
This suddenly started about a month and a half ago. The same code was working earlier so I thought I reached a quota limit but that was not the case.
got my solution In the script -> Resources -> Advanced google services -> turn on Drive API Click in below message " Google Cloud Platform API Dashboard" to open de cloud project for the script. With the project selected, search in the search bar "Drive API" -> ENABLE, do the same for "Google Drive API". Done, no more "we're are sorry server error" for DriveApp functions in the script. Also: I enabled other APIs and advanced services Drive Activity API, just in case...