"This add-on has created too many time-based triggers in this document for this Google user account"

823 views
Skip to first unread message

Ihor Stefurak

unread,
Aug 18, 2020, 5:08:52 AM8/18/20
to Google Apps Script Community
I'm working on a Gmail add-on. There are 2 triggers I need to create. 

When I click a "Create" button in the add-on, the 1st trigger is creating but the 2nd returns an error "This add-on has created too many time-based triggers in this document for this Google user account". But when I go to the script editor and run the function directly, the script creates 2 triggers without any issues.

I checked a triggers section for the script. It's empty cause I delete all the triggers before creation.

Any tips on how to solve the problem or at least debug it?

Alan Wells

unread,
Aug 18, 2020, 9:07:58 AM8/18/20
to Google Apps Script Community
I don't think that deleting the triggers will put quota back.
I don't have a good answer to your question, but hopefully someone will have more information for you.

Ihor Stefurak

unread,
Aug 18, 2020, 10:07:04 AM8/18/20
to Google Apps Script Community
Thank's Alan. Deleting the triggers will put quota back, for sure.

Amit Agarwal answered this question: "Addons [Gmail Add-ons, I guess] can have only a single time trigger at this time". This explains why I'm getting the error. But I don't understand why Google limited the number of triggers to 1.

Alan Wells

unread,
Aug 18, 2020, 10:47:11 AM8/18/20
to Google Apps Script Community
Yes, an add-on can only have one trigger of each type installed.
Google isn't explaining why the limit is 1 of each type for an add-on.
But, we can imagine why.  If any company or person offered unlimited items or services,
then a few people would abuse the generosity.
If the add-on deletes a trigger, then another trigger of the same type can be created,
IF the user is under the limit of 20 triggers per day for that document.
There's a difference between the add on limitation of 1 trigger of one type, and the quota of
20 triggers per day per user per document.  Those are two different things.
The quota is related to how many total triggers an account can create.
If the add-on created and then deleted one trigger at a time, 20 times, and after
doing that 20 times, there was no time based trigger in existence, then on the 21st try,
you'd get a quota limit error, regardless of limit for one trigger of one type per add-on.

Gbade Adewole

unread,
Jan 21, 2021, 2:46:58 PM1/21/21
to Google Apps Script Community
Hi Alan,

Do you know of any workarounds for this? I have seen quite a few apps like G-Connector and API-Connector that allow the user to create multiple time-based triggers (up to 20) so it can been done.

Alan Wells

unread,
Jan 21, 2021, 3:17:45 PM1/21/21
to Google Apps Script Community
I don't know how those add-ons work.
There could be a couple of work arounds.
You could have a trigger that runs every hour, and checks all the settings.
So, there would be a difference between how many settings and how many triggers.
The one time based trigger would just keep running over and over again, and checking all the settings
to determine whether it needed to do something at different times of day.
You can have the function that runs from the trigger delete the first trigger and then install a new trigger.
So, depending upon your need there may be a solution.
But, as far as creating two or more time-based triggers that are active at the same time,
for an add-on that is not possible.
I don't know what the permissions are for those add-ons.
User code, that was owned by the user account, could create multiple triggers,
but then the add-on would need some way to trigger the user owned code.
That would require more set-up by the user.

Mihai A.

unread,
Dec 1, 2021, 3:08:29 PM12/1/21
to Google Apps Script Community
You can actually have multiple time-based triggers within an add-on, it's just that you can only create one such trigger per document. For example, using a Google Sheets add-on, you would need two spreadsheets to activate two time-based triggers.

If you want multiple time-based triggers in a single document.. well you can't, but you could work around that by doing what Alan said, or by using a third party server to do your processing for multiple things, then use a single trigger to fetch the results from your server. For example, if you want to use a single spreadsheet to store both some calls from the Google Analytics API, as well as from the Google Search Console API, you could store those requests on your server, process the data, then retrieve it via a single time-based trigger that runs every day.
Reply all
Reply to author
Forward
0 new messages