【发布时间】:2021-01-21 02:42:35
【问题描述】:
以下代码行在 ScriptA 中有效,但在 ScriptB 中无效:
var folder = DriveApp.getFolderById(folderId);
两个脚本文件中的 oAuth 相同 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"
],
...
我错过了什么?
【问题讨论】:
-
您使用的脚本是否部署为附加组件? @EdmundTo
-
这能回答你的问题吗? stackoverflow.com/questions/64079595/…
-
这可以通过访问菜单
Resources批准脚本文件中的Google Drive API和Drive API来解决 -->Advanced Google Services...,然后启用Drive API,然后在底部单击指向Google Cloud Platform API Dashboard的链接并启用Google Drive API和Drive API。正如@TheMaster 指出的那样,复制到新电子表格的方法有效,但如果您想保留相同的 FileId stackoverflow.com/questions/64079595/…,则并不理想 -
@EdmundTo 考虑将其添加为答案
-
我不允许添加答案,不知道为什么。如果可以,也许您可以添加它,我可以接受吗? @TheMaster
标签: google-apps-script google-sheets server-error