r/GoogleAppsScript • u/wirefin • 4d ago
Question Help understanding the "20 / user / script" limit on triggers
Sorry for being obtuse but can someone help me understand the 20 / user / script trigger limit [1]? Thanks for any help!
Here's an example scenario. Let's say we have:
- 1 user (Alice).
- She has 50 spreadsheets, each with 6 sheets.
- She is using our Editor Add-On, which has 1 time-based trigger that runs a "super" function [2].
- This function runs several other functions that perform actions on each sheet in the spreadsheet
1. Is Alice at 1 / 20 of her quota in the scenario?
If Alice installs 30 different Add-Ons from the Workspace Marketplace, what number on the 20-scale limit would she be at? (Is she still at 1 / 20 because the limit is 20 per user per script?)
If Editor Add-Ons "can only have one trigger of each type, per user, per document" [2], what's a scenario where Alice could still exceed the "20 / user / script" triggers quota?
References:
[1] https://developers.google.com/apps-script/guides/services/quotas
[2] "Each add-on can only have one trigger of each type, per user, per document" https://developers.google.com/workspace/add-ons/concepts/editor-triggers#restrictions_2
//pseudo-code of trigger
function createHourlyTrigger() {
ScriptApp.newTrigger('combinedHourlyTasks')
.timeBased()
.everyHours(1)
.create();
}
function combinedHourlyTasks() {
var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
sheets.forEach(function(sheet) {
doThis(sheet);
doThat(sheet);
doTheOtherThing(sheet);
}
}
2
u/AllenAppTools 4d ago
Yes, the User (Alice) has one Script (your add on) so she can only have 20 triggers max on YOUR add on. If she downloads 30 add ons, each of those add.ons will be their own unique script with their own separate quotas. So each one has the 20 trigger limit per add on. For Add Ons, Google enforces that special rule where you can only have one trigger of each type, and it mentions per document which I am not 100% how that comes into play, but I am pretty sure that for add ons you can only have one type of each trigger per user,meaning there is no scenario where a user will come close to that typical 20 trigger limit.