The following line of codes work in ScriptA but not in ScriptB:
var folder = DriveApp.getFolderById(folderId);
The oAuth is the same in both script files' appsscript.json
:
...
"oauthScopes": [
"https://www.googleapis.com/auth/spreadsheets.readonly",
"https://www.googleapis.com/auth/spreadsheets",
"https://www.googleapis.com/auth/drive.readonly",
"https://www.googleapis.com/auth/drive",
"https://www.googleapis.com/auth/script.scriptapp",
"https://www.googleapis.com/auth/script.external_request"
],
...
What am I missing?
This can be solved by activating the Google Drive API Advanced Services in the script file by accessing the menu
Resources
>Advanced Google Services...
, and then enable the Drive API, and then at the bottom click the link to Google Cloud Platform API Dashboard and enable the Drive API there as well.