I run a small Apps Script in a consumer (@gmail.com) Google account. The script, copySentToJustBear, is fired by a time-based trigger and copies mail from the account’s Sent folder to another mailbox, using GmailApp. For several days it has been failing intermittently with:
Exception: Service invoked too many times for one day: gmail.
The published Apps Script quotas page does not seem to state the number behind this specific error, so I am asking here. Observed behavior, from Google’s own hourly failure-summary emails:
- With the trigger firing every minute, some daytime hours show 50+ failed executions in one hourly summary.
- Other hours (e.g., around 1 AM local) show only 5 failures in the hour, meaning most executions in that same hour succeeded.
- The pattern repeats across days. The mailbox the script watches sends very little mail (0-2 messages/day), so most executions find nothing to copy.
My questions:
- What is the numeric daily limit for the Gmail service (GmailApp) on a consumer account that produces the “too many times for one day: gmail” error?
- What is charged against that limit? Is each method invocation one unit? Does GmailApp.search() cost one unit per call, or is it weighted by the number of threads/messages returned? Do getThreads()/getMessages() cost per item?
- When does this quota reset — midnight Pacific Time, midnight in the account’s timezone, or a rolling 24-hour window?
- Why would failures cluster in some hours while most executions in the same hour succeed? Is this quota also enforced in shorter windows, or is the per-call cost different depending on what the call returns?
- Is this the same quota that GmailApp.getRemainingDailyQuota() reports, or a separate one? If separate, is there any programmatic way to read the remaining Gmail-service quota before a call fails?
- Does a Google Workspace account raise this specific quota, and if so, to what number?
- A mostly-idle execution (a search that returns nothing) — does it cost the same against this quota as an execution that finds and processes messages?
The practical goal: choose a trigger interval (1, 5, 10, 15, or 30 minutes are the available steps) that stays under the real limit with margin, instead of guessing. Any documentation or first-hand measurement of this quota would be appreciated.