Reputation: 7168
I am creating an appscript addon named Everyday Addon
which create trigger named Trigger1
which runs every day.
Trigger1
can be set by Add Trigger
button in addon homepage. Similarly it can be removed by Remove Trigger
button. Similarly remove button is also working, but working on my Addon Appscript project.
Testing:
Test SS
. It has my addon already installed.Add Trigger
button.Results:
Trigger1
is created but it is created on my Everyday Addon
Appscript project. It is not created on the new spreadsheet- Test SS
.
What did I got wrong? Should not the trigger sit on Test SS
spreadsheet's project?
If 100's of user install my addon then 100 of Trigger will sit on my Addon project?
Upvotes: 0
Views: 42
Reputation: 15377
This is intended behaviour!
The trigger that you create programmatically will be attached to the add-on rather than the target Spreadsheet - this is because the function you intend to run on trigger is in the add-on project file, not the target Sheet's bound script.
That being said - this is per-user behaviour. You won't have hundreds of triggers all bound to your script project after publishing because each time a trigger is created by a user it will be tied to their account and not yours.
Remember: the Apps Script Quotas limit triggers to 20 per user per script, so each user can have up to 20 triggers installed via your add-on before they will not be able to install any more.
Further reading: as per the documentation on testing editor add-ons:
Installable triggers aren't supported when testing. Functionality that depends on installable triggers are not testable.
Upvotes: 1