如何与同事共享 Google Apps 脚本?

How can I share a Google Apps Script with my colleagues?

我使用脚本编辑器创建了自定义 Google 表格插件。

现在我想让附加组件在查看其他工作簿时可以访问,我想与我的同事分享它,以便他们也可以使用它 - 我不感兴趣,也不需要将它分享给应用商店。我发现我可以 'share' 在 Google Apps Script 主页区域中与他们一起使用它,并且它在 'Shared with me' 下的 Google Apps Script 区域中变得可见,但我不知道如何打开它以便他们在工作簿中实际使用。我只需要另外 2 个人就可以访问。

正如您提到的,您可以共享脚本但不知道如何将其作为 sheet 的 add-on 进行测试,所以我将只写如何测试它作为 add-on,如果您需要更多帮助,请告诉我。

创建测试配置

  1. 如果您还没有,请创建一个 Sheet、文档或表格来测试 add-on。如果需要,格式化文档并使用 add-on 将对其进行操作的数据进行填充。

  2. 在脚本编辑器中打开包含您的 add-on 的脚本项目。

  3. (可选)您可能希望通过 selecting 文件 > 管理版本,然后保存新版本来保存项目的一个版本。关闭“管理版本”对话框。

  4. Select 运行 > 测试为 add-on.

  5. 在Select版本框中,选择代码版本或select"Test with latest code"。

  6. 在 Installation Config 框中,select 测试的初始授权状态。

  7. 单击 Select 文档按钮。这将打开一个文件 select 对话框。找到要测试 add-on 的测试 Sheet、Doc 或 Form,单击它,然后单击 Select 关闭对话框。

  8. 单击保存以保存测试配置。

运行一个测试配置

  1. 在脚本编辑器中打开包含您的 add-on 的脚本项目。

  2. Select 运行 > 测试为 add-on.

  3. 在执行保存的测试下,找到要执行的测试并select它。单击测试。

我已从该文档中获取文本您也应该阅读这些以供参考。

https://developers.google.com/apps-script/add-ons/test#create_a_test_configuration

https://developers.google.com/apps-script/add-ons/test#run_a_test_configuration

您的下一步是Publishing that Add-on,以便与朋友或同事分享。

Publishing add-ons allows them to be used by other users in their own documents. Public add-ons require a review before publication, although if you are a member of a private G Suite domain, you can publish just for users within your domain without a review. You can also publish an add-on for domain-wide installation, which lets a domain admins find, authorize and install your add-on on behalf of all users within their domain.