javascriptgoogle-apps-scriptgoogle-sheetsgoogle-appsgoogle-apps-marketplace

Is there any way to package google script code as add-on to Google Sheet?


Is there any way to package Google script code as add-on to Google Sheet or lock the code so no one can view or edit the script code except specified user OR owner?

If packaging as add-on is the only option, is it going to publish the add-on somewhere in the marketplace? I do not want the packaged add-on to ve available publicly.


Solution

  • Answer:

    Yes this is possible, but it depends on what you want to do and how you wish to implement your addon.

    More Information:

    First thing that should be mentioned, as per Google's documentation:

    All add-ons are now published to the G Suite Marketplace. Originally, add-ons were published to the Chrome Web Store, and could optionally be published in the G Suite Marketplace to make them domain-wide installable.

    Google have recently started migrating the Chrome Web Store to the G Suite Marketplace and so add-ons should now all be published there. You can see the migration information here.

    Bearing this in mind, there are a couple of ways in which you can achieve what you are wanting to do:

    Firstly, you can go through the publishing proicess to have an add-on installed in the G Suite Marketplace. You can set the visibility to determine who is able to install the add-on, which can be set to your domain only and therefore not publically available. The add-on must must be associated with a Google Cloud Platform (GCP) project. You can also set collaborators of the add-on - these are the only people that can edit and view the code for the add-on.

    Alternatively, you can set the sharing options for the script like you would any other Drive file for the script. This isn't really recommended though - allowing people to use the add-on means that they'll have code access if unpublished, and even if not they would be able to make a copy of the script if given the script ID.

    References: