Gemini API Quota Exceeded in Apps Script: Backoff Plan
Fix gemini app script quota exceeded errors in Apps Script with practical checks for API limits, retries, batching, and the right Gemini project.

If you see “quota exceeded” while calling Gemini from Google Apps Script, the script has usually sent too many requests for the active API project or model. The most common cause is a burst of calls from a loop, trigger, or multiple users that hits a per-minute limit—not a problem with ChatGPT, Copilot, Claude, or another assistant.
Gemini API limits depend on the project, model, and current quota settings. Apps Script can make a burst look larger than expected when several executions run at once, and repeated retries can make the burst worse.
Open the script at script.google.com, then select Project Settings and check the associated Google Cloud project. In Google AI Studio, confirm the API key belongs to that project; then check the model name in the request URL or payload. The fix is confirmed when the key, project, and model match the quota page you are inspecting.
Open Google AI Studio’s API key and usage or rate-limit information, or use the linked Google Cloud project’s quota pages when applicable. Check the selected model’s request and token limits, usage, and any billing status shown for that project. If usage is at a limit, wait for its reset or request higher access where offered; a limit shown for another project or model does not explain this script’s error.
In the Apps Script editor, open Executions to see whether manual runs or time-driven triggers overlap. Review Triggers from the left sidebar and remove duplicate schedules or reduce their frequency while diagnosing. If executions no longer overlap and the error stops during the same workload, concurrency was contributing to the quota hit.
For a retryable rate-limit response, wait progressively longer before retrying, and cap the number of attempts. For example, start with a short delay and double it after each failed attempt, adding a small random delay so parallel executions do not retry together. In Apps Script, use Utilities.sleep(milliseconds) within a bounded retry loop; inspect the HTTP status and response body first, and do not retry authentication, invalid-request, or other permanent errors. A successful later attempt confirms the limit was temporary, but backoff does not increase the quota.
Combine related inputs into fewer requests when the model and task allow it, trim unnecessary prompt text, and avoid sending the same context repeatedly. If processing a sheet, read a range once with getValues(), prepare the work in memory, and write results back in a batch instead of making a Gemini call for every cell. A lower request count or token use in the project’s usage view confirms the change is helping.
For larger jobs, split items into manageable batches and process them over time instead of launching one request per row in a single run. Store a progress marker in PropertiesService and resume from a time-driven trigger, leaving enough time between batches for the applicable limit to recover. Confirm the queue advances without repeated quota errors and that each item is processed only once.
Log the response code and a shortened response body, but never log your API key. A rate-limit message points toward pacing or quota; an authentication or permission message calls for checking the key and project instead. Do not assume enabling billing will remove every limit: verify what the active project’s quota page says and follow its stated requirements.
| Likely cause | Typical symptom | Quick test |
|---|---|---|
| Per-minute request or token limit | Fails during a burst, then works later | Retry one request after a pause |
| Overlapping executions | Errors coincide with triggers or multiple users | Check Apps Script Executions |
| Daily or project limit | Requests keep failing until usage resets or access changes | Inspect quota for the active project and model |
Check the active project and model, then compare their current quota with usage. Reduce concurrent calls and add bounded backoff for temporary rate limits.
It can help when a temporary rate limit clears after a short wait. It will not fix exhausted daily quota, a disabled service, an invalid key, or a permanent permission error.
The two tests may use different API keys, projects, models, or request volumes. Verify the key’s project and model in the script, then inspect quota for that exact combination.
Most Apps Script quota errors clear once you identify the active limit, reduce bursts, and retry temporary failures with bounded backoff. If nothing worked, save the response details without the key and compare them with the current project and model quota information before changing the integration.
Photo: Shixart1985 / CC BY 2.0 (Wikimedia Commons)
Fix gemini app script quota exceeded errors in Apps Script with practical checks for API limits, retries, batching, and the right Gemini project.
ChatGPT export conversation missing? Learn what the archive includes, why messages may be absent, and how to check account, chat history, and export settings.
Copilot Excel pivot table help: fix source data, check Copilot access, and build a reliable PivotTable manually when AI can’t create it.
Fix teams transcript not showing issues by checking meeting policy, organizer controls, licensing, transcript access, and where Teams stores completed transcripts.
Fix whisper srt timing off by checking audio alignment, transcript edits, export settings, and manual SRT timestamps so subtitles stay in sync.
Fix chatgpt pdf table extraction wrong results with six practical prompts, source checks, and export steps for cleaner tables in ChatGPT and other AI assistants.
Fix chatgpt canvas not saving by checking save status, connection, browser cache, extensions, and workspace access, then recover or copy your latest edits safely.
Fix gemini deep research not available by checking your account type, plan, region, age eligibility, administrator controls, and temporary usage limits.
Fix gemini in google sheets not showing by checking Workspace eligibility, admin controls, smart features, file format, account selection, and browser issues.
Hit the notebooklm source limit? Learn how to combine files, split notebooks by project, and check current limits so you can use 300+ work documents effectively.