Distributing Web Apps for Domain-wide Installation

Web apps built with Apps Script can be distributed in the G Suite Marketplace, where G Suite domain administrators can find, install and authorize them for all or some users in their domains.

Distributing checklist

This section lists a number of considerations and details that you should address when you distribute a web app.

Team ownership of the web app

If you are building the web app as part of a team, think carefully about which account you want to publish from. Collaborating with Team Drives is recommended. Alternatively, you may wish to create a common team account to serve as the owner of the script project. Avoid situations where you lose access to your add-on's code and console settings because a member of your team left your organization.

Changing web app ownership across domains

Web apps deployed in one domain cease to function if their ownership changes to a Team Drive or account in a different domain. This can be corrected by having the new owner or collaborator redeploy the web app in the new domain. Alternatively, if the web app is moved back to its original domain the web app will start functioning again for that domain without redeploying.

Steps to prepare for distribution

Prior to distributing, you should:

Domain-wide distribution instructions

Domain-wide distribution requires configuring the G Suite Marketplace SDK for your web app. In order to do this, you must have access to the Cloud Platform project the add-on uses, which may not be the case if the script resides in Team Drive. If necessary you can switch your script to use a standard Cloud Platform project that you can access.

In addition, domain-wide distribution also requires a manual modification of the web app's Chrome Web Store manifest and republication before it can be installed by G Suite domain admins. The full procedure is outlined in the steps below.

Configure the G Suite Marketplace SDK

  1. If you have not done so already, distribute your web app to the Chrome Web Store. When filling out the Edit Item form, make sure the Visibility options is set to Private.
  2. Open your web app script in the Apps Script editor.
  3. Click Resources > Cloud Platform project. In the dialog that appears, click the name of the project your script is associated with.
  4. In the console's left navigation, expand the section APIs & auth and click APIs.
  5. In the filter box, type "marketplace", then click G Suite Marketplace SDK (not the API) once you see it.
  6. On the next screen, click Enable API.
  7. You may be prompted to accept the Google APIs Terms of Service and the G Suite Marketplace SDK Terms of Service Read the terms carefully, then check the box and click Accept.
  8. Once the G Suite Marketplace SDK has been enabled, click the Configuration tab. This will open the SDK configuration form.
  9. In this form enter the following:
    • the Application Description
    • the four Application Icons (they will be automatically resized if needed)
    • a Terms of Service URL that points to terms of service documentation for your web app.
  10. Under Extensions, check the Enable Universal Navigation extension box. This will bring up a text field for your web app's URL. You can find this URL in the script editor:
    • Click Publish > Deploy as web app.
    • Copy the URL listed under Current web app URL.
    • Paste this URL into the Universal Navigation extension field.
  11. Click Save changes at the bottom of the console.

At this point the web app is configured for use in the G Suite Marketplace, but it will not be visible there until its Chrome Web Store entry is updated and republished.

Download and edit the web app manifest file

  1. Open the Chrome Web Store Developer Dashboard.
  2. Find the entry for the web app. On the right side of the entry, click More info.
  3. In the small window that opens, click main.crx next to the Download label to download the web app manifest and associated files (in a compressed archive).
  4. Move the downloaded .crx file to an empty working directory.
  5. Uncompress the .crx file as you would a .zip file (on most Linux machines you can do this with the command unzip; you may need to rename the file to have a .zip extension first). It will inflate into several files, including "manifest.json".
  6. Open "manifest.json" in a text editor. You can add additional whitespace to make this file more readable, but be careful not to change the text.
  7. Increment the value for the "version" by 1.
  8. Add the following top-level key: "container": ["DOMAIN_INSTALLABLE"].
  9. Add the following top-level key: "api_console_project_id": "your_web_app_project_number". Your web app project number can be found through the script editor:
    • In the script editor, select Resources > Cloud Platform project.
    • In the dialog that appears, click the name of the project your script is associated with.
    • In the new window that opens, click the down arrow next to the project's ID. The console will then show your Project number, which consists only of numerals.
    • Copy this project number into the "manifest.json" file as the api_console_project_id. Close the window.
  10. The manifest file should now have a structure similar to the manifest file documentation. Verify that the structure matches and save the file.

Upload the edited manifest and republish

  1. Create a new "updated.zip" file, containing all the original files and your updated manifest. Do not include the original .zip or .crx file.
  2. In the Chrome Web Store Developer Dashboard, find the entry for your web app. On the right side of the entry, click Edit. This will open the Edit Item form you filled out previously.
  3. Under Upload, click the Upload Updated Package button.
  4. In the new window, click the Choose file button. Find the "updated.zip" file you created and select it. Click Open.
  5. Click the Upload button.
  6. If there are any problems with your manifest file, you will be alerted to them now. Correct any problem and repeat the file upload steps.
  7. When the upload completes correctly, you will be taken back to the Edit Item form. Click the Publish changes button at the bottom.
  8. Visit the Chrome Web Store developer dashboard to see the status of your web app. Note that the publication process can take up to an hour to finish. Note that the Status column will now have two items, indicating the publication status, one for the Chrome Web Store and another the G Suite Marketplace. When both read as "Published", you're done!

Install a published web app for a domain

To install the published web app on for all users in a G Suite domain, see this support article. Note that only an administrator can install an app for all users in the domain.

发送以下问题的反馈:

此网页
Apps Script
Apps Script