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:
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...
I ran into this issue too...
Like Nicolás Paulino mentioned, check your "Advanced Google Services" are turned on with the Apps Script Editor UI..
As stated...from the apps script editor..
Then head to ... https://console.cloud.google.com/apis/library?project={yourProjectId}
Click on the menu (top-left)
I've just had your same issue and it took me forever to fix it. What worked for me was to create a copy of the spreadsheet with the bound script. After authorising everything again in the copy, it worked. Hope it helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With