An Apps Script Writes to the Wrong Google Sheets Tab: Use Explicit File and Sheet IDs
A script that writes to the active tab can target the wrong place when its execution context changes. Use explicit target validation before any operational write.
144 guides
A script that writes to the active tab can target the wrong place when its execution context changes. Use explicit target validation before any operational write.
onEdit responds to a user changing a spreadsheet value. A formula recalculation, script write, or API update does not automatically behave like that user edit.
Two similar executions can come from duplicate trigger installations, different creators, or repeated event handling. Inspect the execution path before deleting triggers broadly.
An Apps Script quota error can stop execution after some work already completed. Identify the specific limit and saved progress before restarting the whole dataset.
HTTP 429 indicates that a Sheets API request exceeded an applicable rate quota. Use bounded retries with backoff, while treating ambiguous writes separately from a clear rejection.
The Sheets API’s value input option controls parsing. Choose it based on whether a field is literal data or intended spreadsheet input.
The Sheets API can return a displayed string, an underlying calculated value, or a formula. Choose the render option that matches the receiving program’s purpose.
Debug logs can become another copy of sensitive spreadsheet data. Record enough context to diagnose the operation without dumping full rows, credentials, or private contact fields.
Testing automation on a copy reduces risk only if the code actually targets the copy. Validate file IDs, trigger identity, and external side effects before running it.
Counting populated cells and counting distinct values answer different questions. Define which blanks and invalid entries should be excluded before reporting a unique-customer or unique-code total.