Skip to content
Google Apps Script · error message

Apps Script: Too many simultaneous invocations: Spreadsheets

RetryableConcurrent executions

Last verified

The exact message
Exception: Too many simultaneous invocations: Spreadsheets

What it means

This exception means too many executions were calling the same service, typically the Spreadsheet service, at the same time. It is a concurrency limit, separate from daily quotas and from the 6-minute runtime limit.

Google's quotas page lists 30 simultaneous executions per user and 1,000 per script. In practice the Spreadsheets variant shows up intermittently on triggered scripts, form-submit handlers and web apps when several runs overlap and all read or write the same spreadsheet.

Nothing is wrong with the code's logic; the same function succeeds when it runs alone. The fix is to stop overlapping runs from colliding.

What it looks like

function onFormSubmit(e) {
  const lock = LockService.getScriptLock();
  lock.waitLock(30000);
  try {
    SpreadsheetApp.getActive().getSheetByName('Log').appendRow(e.values);
  } finally {
    lock.releaseLock();
  }
}

Why it happens

  • Multiple form submissions or webhook calls arriving together, each starting its own execution.
  • A web app (doGet or doPost) receiving bursts of requests.
  • Overlapping time-driven triggers when a run takes longer than the trigger interval.
  • Custom functions in many cells calling SpreadsheetApp at once.

How to fix it

  1. Serialize access with LockService: call getScriptLock().waitLock(30000) before touching the sheet and releaseLock() after.
  2. Catch the exception and retry with exponential backoff instead of failing the whole run.
  3. Reduce the number of calls per execution by batching reads and writes.
  4. Make sure time-driven runs finish well within their interval so they cannot overlap.
  5. For web apps receiving bursts, write incoming items to a queue (a sheet or properties) and process them in one scheduled run.

How to stop it recurring

Any handler that can be triggered concurrently should take a script lock before writing shared data. Keep the locked section short, and process bursts asynchronously from a queue. Note that waitLock throws if it cannot get the lock in time, so handle that case too.

Official documentation: developers.google.com/apps-script/guides/services/quotas. See all Apps Script error messages or the Apps Script limits and quotas.

Related errors

Definitions

Quick answers

What does "Too many simultaneous invocations: Spreadsheets" mean in Apps Script?

This exception means too many executions were calling the same service, typically the Spreadsheet service, at the same time. It is a concurrency limit, separate from daily quotas and from the 6-minute runtime limit. Google's quotas page lists 30 simultaneous executions per user and 1,000 per script.

How do I fix "Too many simultaneous invocations: Spreadsheets"?

1. Serialize access with LockService: call getScriptLock().waitLock(30000) before touching the sheet and releaseLock() after. 2. Catch the exception and retry with exponential backoff instead of failing the whole run. 3. Reduce the number of calls per execution by batching reads and writes. 4. Make sure time-driven runs finish well within their interval so they cannot overlap. 5. For web apps receiving bursts, write incoming items to a queue (a sheet or properties) and process them in one scheduled run.

Run the job somewhere with its own limits

If a script keeps hitting its host's quotas, an Autonoly workflow can run the same steps on a schedule in an isolated cloud container, and the AI agent has a terminal with Python for steps that need code. Autonoly has limits of its own, priced in credits.

Also see Agent terminal & SSH.