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.
CodePudding user response:
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.
CodePudding user response:
These are the currently available methods to distribute:
-
- Published add ons are very useful in distributing the functionality of the script with many users
- Unpublished add ons can be shared directly by sharing the script. They have a lot of restrictions.
- Simple triggers(like
onOpen
) are triggered automaticallyref. - Installable Triggers(like
onChange
) are managed by the script per user
-
- 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
-
- 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
-
- 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)