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?
Google Drive API
andDrive API
in the script file by accessing the menuResources
-->Advanced Google Services...
, and then enable theDrive API
, and then at the bottom click the link toGoogle Cloud Platform API Dashboard
and enable bothGoogle Drive API
andDrive API
. As @TheMaster has pointed out, the method of duplicating to a new spreadsheet works but is not ideal if you want to preserve the same FileId stackoverflow.com/questions/64079595/… – Edmund To