首页 > 解决方案 > 如何清除“例外:您无权调用...”?

问题描述

我正在打开一个包含 Google Apps 脚本的 Google 表格文档,而不是插件。一些脚本代码会在文档打开时自动运行,并且需要各种权限。最近我收到一条错误消息,具体取决于每个功能所需的权限,例如:

例外:您无权调用 UrlFetchApp.fetch。所需权限:https ://www.googleapis.com/auth/script.external_request

为了解决这个问题,我将脚本概述页面中列为“Project OAuth Scopes”的五个脚本添加到了 appsscript.json:

{
  ...
  "oauthScopes": [
    "https://www.googleapis.com/auth/script.send_mail",
    "https://www.googleapis.com/auth/drive",
    "https://www.googleapis.com/auth/script.external_request",
    "https://www.googleapis.com/auth/script.container.ui",
    "https://www.googleapis.com/auth/spreadsheets"
  ],
  ...

这并没有什么不同。

如何让 Google 相信我要为文档及其包含的脚本授权这些权限?是否有一种方法可以强制进行授权对话,例如在我开始编码时遇到我?谢谢!

标签: google-apps-scriptgoogle-sheetstriggers

解决方案


推荐阅读