在您的公司网络中分发适用于表格的 Google Apps 脚本

Distributing Google Apps Scripts for Sheets in your company network(在您的公司网络中分发适用于表格的 Google Apps 脚本)
本文介绍了在您的公司网络中分发适用于表格的 Google Apps 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

  • 我的公司使用 Google 云端硬盘来存储其文档等.
  • 我们通过将 Google 产品数据文件加载到电子表格中来搜索我公司的 Google 产品数据文件,但 ImportXML 并不能满足我们的所有需求.
  • 因此,我制作了一个简单的 Google Apps 脚本文件来处理数据,并将其输出到打开的电子表格中当前活动的跨页.
  • 机制由 UI 菜单/模式组合控制.
  • 我一直在开发它作为附加到电子表格的脚本,但现在我想让其他有权访问 Google 云端硬盘的人使用它.
  • 如何分发此脚本,并在有人加载新的 Google Sheet 文档时让它运行 onOpen()?
  • 我只想将脚本存储在公司范围内的 Google Drive 上,让人们安装"它或其他东西,然后通过菜单 UI 运行它.
  • 理想情况下,这意味着我可以随时调整脚本,因为人们从同一来源加载脚本.

我唯一的解决方案真的是让人们将代码复制粘贴到他们自己文档的脚本编辑器中,然后手动运行 onOpen() 吗?(根本无法维护 + 难以教授).

Is my only solution really getting people to copy-paste the code into their own documents' Scripts Editor, and run onOpen() manually? (Not at all maintainable + hard to teach).

推荐答案

如果您的组织使用 G Suite 帐户,则域管理员可以在域范围内"安装插件.

If your organization is using a G Suite account, an add-on can be installed "domain wide" by the domain administrator.

要了解您的域管理员是谁,请使用以下链接:

To find out who your domain administrator is, use the following link:

https://support.google.com/a/answer/6208960

域范围的安装与在其用户帐户中安装插件的个人之间存在差异.

There is a difference between domain wide installation, and an individual installing an add-on in their user account.

要在域范围内安装插件,域管理员必须登录,并以域管理员的身份身份安装插件.首先,域管理员必须打开管理控制台.

For the add-on to be installed domain wide, the domain administrator must be signed in, and install the add-on as the domain administrator. First the domain administrator must open the admin console.

要登录 G Suite 管理员主页,请使用以下链接:

To log into the G Suite admin home page use the link:

https://admin.google.com/AdminHome

管理员必须导航到 G Suite Marketplace,找到插件并安装它.

The administrator must navigate to the G Suite Marketplace, find the add-on, and install it.

在安装插件之前,管理员必须从 G Suite Marketplace 启用 Google 插件,或者如果您不想允许安装所有插件,则将特定插件列入白名单.

Before an add-on can be installed, the Administrator must either enable Google add-ons from the G Suite Marketplace, or whitelist a specific add-on if you don't want to allow all add-ons to be installed.

从管理主页导航:

  • 应用程序
  • G 套件
  • 云端硬盘和文档
  • 功能和应用
  • 附加组件
  • 开启

如果插件安装通常受到限制,则可以将特定插件列入白名单.为了将插件列入白名单,管理员需要插件脚本的 App ID.脚本的 App ID 必须由脚本的所有者提供.

A specific Add-on can be whitelisted if add-on installation has been restricted in general. In order to whitelist an add-on the administrator will need the App ID of the add-on script. The App ID of a script must be provided by the owner of the script.

请注意,此处提供的域范围安装说明假定插件已发布到 G Suite Marketplace.文档中解释了如何为 G Suite Marketplace 验证和批准插件.

Note that the instructions provided here for domain wide installation, assume that the add-on is already published to the G Suite Marketplace. Getting an add-on verified and approved for the G Suite Marketplace is explained in the documentation.

申请发布

安装 Marketplace 应用控制 Marketplace 应用的用户安装

附加组件的替代方案是库:

An alternative to an add-on is a library:

想要使用该库的用户需要进行一些安装.他们需要从电子表格中打开 Apps 脚本代码编辑器,然后输入库密钥.

The users who want to use the library need to do some installation. They would need to open the Apps Script code editor from the spreadsheet, and enter the library key.

文档 - 库

Apps Script API 可用于创建新项目(脚本)文件并覆盖现有项目文件.但问题是,脚本需要绑定到工作表,并且目前没有以编程方式获取绑定到工作表的项目的脚本 ID 的方法.(如果这发生了变化,并且您注意到了,请发表评论以更新答案)如果您知道绑定到工作表的项目 ID,那么您可以使用 Apps Script API 覆盖脚本文件,或者您可以以编程方式更新项目文件的 appsscript.json 文件中的库版本号.这将提供一种将绑定脚本部署到工作表文件或更新库版本号的方法.您可以手动获取和保存哪些脚本 ID 绑定到哪些表格文件,然后使用 Apps 脚本 API 覆盖项目文件.用户需要创建一个绑定到工作表的脚本,然后提供项目文件 ID,或者用户可以复制模板工作表的文件并绑定脚本.

The Apps Script API can be used to create new project (script) files and overwrite existing project files. But the problem is, that the script would need to be bound to the Sheet, and there is no current way to programmatically get the script ID of projects bound to Sheets. (If this changes, and you notice, then make a comment to update the answer) If you know the project ID that is bound to the Sheet, then you could use the Apps Script API to overwrite the script file, or you could programatically update the library version number in the project file's appsscript.json file. That would provide a way to deploy bound scripts to Sheet's files, or update library version numbers. You could manually get and save which script IDs were bound to what Sheets files, and then use the Apps Script API to overwrite the project file. The user would either need to create a script that was bound to the Sheet, and then provide the project file ID, or the user could copy a template Sheet's file with a script bound to it.

这篇关于在您的公司网络中分发适用于表格的 Google Apps 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Google apps script get range of bytes from binary file(谷歌应用程序脚本从二进制文件中获取字节范围)
Sending Multiple attachments with Google Script from Google Drive(使用 Google 脚本从 Google Drive 发送多个附件)
Upload file to my google drive from anyone using javascript(使用 javascript 将文件从任何人上传到我的谷歌驱动器)
quot;Shared Drivequot; support in Google Apps Script(“共享驱动器Google Apps 脚本中的支持)
Angular 2+ HTTP POST and GDrive API. Resumable file upload with name(Angular 2+ HTTP POST 和 GDrive API.带名称的可恢复文件上传)
Student Gradebook. Unable to complete script because of quot;Access denied: DriveAppquot;(学生成绩册.由于“拒绝访问:DriveApp而无法完成脚本)