Search code examples
google-apps-scriptgoogle-cloud-platformmenugoogle-docs

Can't get menu item to show in an unpublished add-on for google document


My code look like that:

function onInstall(e) {
  onOpen(e);
}

function onOpen(e) {
  DocumentApp.getUi().createAddonMenu()
  .addItem("Format Your Text", "autoFormatting")
  .addToUi();
}

function autoFormatting() {
  //some code
}
  • I have set a project in Google Cloud Platform and linked in to my Google Apps Script unbound project.
  • Enabled the G Suit Marketplace SDK and configured it.
  • The version is the correct one.
  • When I test the script as add-on in any state (installed/enabled/both) the menu item shows under the "Add-ons" native menu.

What can cause this? How can I fix it?

I don't want to publish the add-on at the moment, but only to share it with other users from my domain.


Solution

  • Answer:

    If you wish to share an add-on for Google Docs with members of your domain, it first has to be published. There is no way around this.

    More Information:

    From the Publishing G Suite add-on documentation:

    Private add-ons are only visible to users in the same domain as the add-on publishing account. Only domain accounts can publish private add-ons. They can't be installed by outside users. Private add-ons do not require add-on review. Private visibility is also referred to as My Domain visibility.

    And:

    Visibility: Only published add-ons have a meaningful visibility status.

    If you wish to have this add-on usable by other people in your domain, you first need to Privately publish it before it can be used.

    Otherwise, you can send another user your add-on script and get them to follow the deployment steps to use it for their account.

    References: