我正在尝试使用App Script在Google Doc中显示一个消息框。
Browser.msgBox("Hi There");
当我运行这个时,我收到以下错误。
您无权调用Browser.msgBox。所需权限:(https://www.googleapis.com/auth/spreadsheets.currentonly || https://www.googleapis.com/auth/spreadsheets)(第2行,文件“恢复”)
以下是我的doc项目中的清单条目。
"oauthScopes" : [
"https://www.googleapis.com/auth/activity",
"https://www.googleapis.com/auth/script.container.ui",
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/documents.currentonly",
"https://www.googleapis.com/auth/drive",
"https://www.googleapis.com/auth/drive.appdata",
"https://www.googleapis.com/auth/gmail.compose",
"https://www.googleapis.com/auth/script.scriptapp"
]
任何人都可以告诉我如何使Browser.msgBox("Hi There")
工作而不在清单中添加工作表权限?
如果我的理解是正确的,那么这个变通方法呢?不幸的是,类浏览器可用于电子表格。 The official document说如下。
此类提供对Google表格特定对话框的访问。
此类中的方法仅适用于Google电子表格的上下文。请改用G Suite对话框。
那么如何使用Class Ui如下呢?
DocumentApp.getUi().alert("Hi There");
如果我误解了你的问题,我道歉。