1

i was wondering if there is a possibility to distribute my Custom Script to all the sheets in my workspace. I came upon different ways with libraries or Add-ons, but they all lack some points i want to accomplish.

  1. I want it to be private only for my Google Account
  2. I need it to run the onOpen(e) Trigger for every File on my Sheets Account (So i can add a custom menu to all my Files)
  3. I also need to set a time Trigger for each File so my main() Function runs every night (right now i always create a new trigger when i rerun my main Function)

So far i can use the Library Option and create a new Script for all my Files and call my Main Function out of that Library. This Workaround does not include an onOpen Trigger event. When i use the Ability of run->test as addon and manually add all new Files (which come up every new month) i also lack the possibility of trigger functions.

If you have Solution Ideas I'd be very happy.

BR NJ

1 Answer 1

2
  • An Add-on can be published privately. Private Add-ons
  • A Library is private by default - The only way that someone outside of your account can use your script as a library, is to set the file sharing to allow them to use it. Gaining access to a library
  • A Library can not run a simple trigger, but an Add-on can. The reserved function name onOpen() can't be triggered by a library. See Table - Resource Scoping
  • An Add-on can run the onOpen() function
  • An Add-on can create an add-on menu.
  • An Add-on can create one time-based trigger for each document it is installed in. Quote: "Each add-on can only have one trigger of each type, per user, per document" Add-on Restrictions

If you want to do something like overwrite an Apps Script file, that can be done with the Apps Script API. Even script projects that are bound to a document (Sheets, Forms, Docs) can be overwritten with the Apps Script API.

StackOverflow answer - Update an Apps Script file using Apps Script

You can also update the manifest file of an Apps Script file using the Apps Script API, and therefore, programmatically add a library, and the library version to an existing Apps Script File.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.