且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我的 Google Apps 脚本如何由共享工作表的其他人运行?

更新时间:2023-12-01 10:27:28

要解决这个问题,您需要将脚本部署为 Web 应用程序(想法来自@MarioR 答案,但设置不同):

To fix this, you need to deploy the script as a web app (the idea comes from @MarioR answer, but the settings are different):

  • 使用所有者帐户,打开工作表,然后打开脚本编辑器
  • 点击Publish,然后Deploy as web app
  • 对于 Execute the app as,选择 访问网络应用程序的用户,对于 谁有权访问应用程序,选择 任何人
  • With the owner account, open the sheet, then script editor
  • Click on Publish and then Deploy as web app
  • For Execute the app as, choose User accessing the web app and for Who has access to the app, choose Anyone

用户第一次尝试使用该脚本时,他们必须允许该脚本(如果他们得到一个此应用未验证,他们应该点击高级code> 在底部,然后 Go to <script name> (unsafe)).在此之后,他们可能需要刷新工作表才能运行脚本.

The first time the users try to use the script, they will have to allow the script (if they get a This app isn't verified, they should click on Advanced at the bottom and then Go to <script name> (unsafe)). After this, they may need to refresh the sheet to be able to run the script.

如果所有者将工作表共享给新用户,则在将脚本部署为 Web 应用程序后,新用户可能需要等待 15 分钟(左右)才能被允许授权脚本(同时该用户将继续收到红色警告).

If the owner shares the sheet to a new user, after the script has been deploy as a web app, the new user may need to wait 15 minutes (or so) before being allowed to authorize the script (meanwhile this user will continue to get the red warning).

只有所有者可以部署为网络应用程序,其他尝试这样做的用户不会收到消息错误,只是一个弹出 Fetching Data 永远卡住!)要更改所有者:使用所有者帐户打开工作表,单击 Share > Advanced > 单击触发准所有者"旁边的下拉菜单的箭头" > 设为所有者

Only the owner can deploy as a web app, the other users who try do to it won't get a message error, just a popup Fetching Data that remains stuck forever!) To change the owner: open the sheet with the owner account, click on Share > Advanced > Click on the arrow that triggers the dropdown next to the "owner-to-be" > Set as owner