Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to share or distribute google apps script with other users?

I have created 1 google app script project. which sends me an email every morning with schedule and tasks.

  • It has .gs script
  • And a trigger to execute everyday

If I want to share this with other users, haw can I share with them? Do I need to share the code and trigger or is there any good way to share apps script.

like image 991
Gaurav Avatar asked Dec 14 '25 09:12

Gaurav


2 Answers

These are the currently available methods to distribute:

  • Add on

    • Published addons don't need to publicly share the code
    • Unpublished add ons can be shared directly by sharing the script. They have a lot of restrictions.
    • Unpublished google-workspace-add-ons can be used in multiple sheets without the need to copy paste scripts across
    • Simple triggers(like onOpen) are triggered automaticallyref.
    • Installable Triggers(like onChange) are managed by the script per user
  • Library

    • Users need at least read access to the script
    • Triggers are not shared
    • End users still need to create their own apps script, which accesses the library
  • Web app:

    • Variety of distribution options
    • If you don't want to share source code, you don't have to, but the web app should be published to run as yourself and should be accessible to "anyone"
    • Triggers are managed by the script. Installable triggers can be created per user. But simple triggers cannot be triggered "directly" from a http GET/POST. However, simple triggers are triggered in the project itself that is bound to a document(say, Google sheets)
    • End users still need to create their own apps script, which accesses the web app using HTTP requests GET or POST
  • google-apps-script-api?:

    • This is mostly used to run your script as yourself without accessing the code editor, but can also be used to distribute if both the calling project and the target project uses the same GCP

Under most circumstances, you'll be restricted to less than 100 end users, except in case of published add ons or web apps(set to execute as the end user)

like image 99
TheMaster Avatar answered Dec 16 '25 10:12

TheMaster


You can publish the script as a web app and set the app to execute as the authenticated user.

When your users launch the web app, they would authenticate the app with their own Google account credentials and the triggers would be added to their account.

With this approach, there's no need to create the script's source code with your users.

like image 37
Amit Agarwal Avatar answered Dec 16 '25 09:12

Amit Agarwal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!