【发布时间】:2021-06-03 11:41:16
【问题描述】:
我们正在开发一个 Google 表格插件来操作 Google 表格。根据Google documentation,建议使用独立脚本开发附加组件。我们还关注了sample script 来创建一个插件。
我们创建的插件使用SpreadsheetApp.getActive() 访问打开的电子表格。这行代码在我们的 Google Workspace 域和我们的个人 Gmail 帐户 (.gmail.com) 上运行良好。
现在我们试图在不同的域上复制同一个项目,上面提到的代码返回 null。这显示了独立应用脚本的行为。
我的问题是我们是否需要在 G-Suit 帐户上启用任何管理员设置,才能让插件访问电子表格?
【问题讨论】:
-
你是如何在新域上执行代码的?
-
还有你的项目使用什么范围?
-
我们在新域中创建了工作代码的精确副本,并尝试使用测试部署运行它,并将其部署到 Google Workspace Market。
-
我们使用多个作用域如下:“googleapis.com/auth/drive.file”、“googleapis.com/auth/script.container.ui”、“googleapis.com/auth/spreadsheets”、“google.com/m8/feeds”、“googleapis.com/auth/userinfo.email”、“googleapis.com/auth/script.send_mail ", "googleapis.com/auth/script.external_request", "googleapis.com/auth/drive", "googleapis.com/auth/spreadsheets.currentonly"
标签: google-apps-script google-sheets google-sheets-api google-workspace