Major

Google Sheets Automation: Surviving the Second Week

Macros, Apps Script, and Zapier all get a sheet automation working on day one. None of the guides covers day eight, when a re-run duplicates every row it already processed and nobody finds out for a week. Here is what a Sheets automation needs to keep running.

Jose GironUpdated
Major x Google Sheets lockup for Google Sheets automation with agents

How do you automate Google Sheets?

There are four ways to do Google Sheets automation: formulas, the macro recorder, Apps Script with installable triggers, and an external tool or agent calling the Sheets API. All four get a task running on day one. Keeping it running unattended needs three things none of them provide by default: a record of which rows were already processed, a place for rows that fail validation, and an alert when a scheduled run stops.

That is a small application with state, and it is where Major fits. Major's agent builds the app that holds the marker, the quarantine log and the heartbeat, so the repeatable work runs as deterministic code and the model only handles the ambiguous rows. The build section below covers it.

The four approaches, compared

  • Formulas: ARRAYFORMULA, QUERY and IMPORTRANGE recalculate on their own. If a column should always show a calculation, stop here. A renamed header still breaks QUERY.
  • Macro recorder: Extensions, Macros, Record macro writes Apps Script from your clicks. Google's help page says absolute references act on "the exact cell you record", so an inserted column misdirects it. It keeps no state.
  • Apps Script: JavaScript with installable triggers that run as often as every minute. Timing is randomized, so a 9 AM daily trigger fires somewhere between 9 and 10. State lives nowhere unless you add a column or use PropertiesService.
  • External tools and agents on the API: Zapier, Make, Pipedream, your own code, or an agent. The only approach where logic and memory live outside the file.

Why Sheets automation breaks in week two

A cell is addressed by coordinate. A row has no identity. Sort the sheet and row 47 becomes row 12. Insert a column and every reference to column D points at the wrong data. There is no key to deduplicate against unless you add one.

Four failures show up repeatedly.

  • The re-run duplicates everything. The script restarts or someone runs it by hand, nothing records what was handled, and row 1 gets processed again. Fix: a durable marker, advanced only after a row completes.
  • One bad row kills the batch. spreadsheets.batchUpdate is all or nothing. Google's limits page says "Invalid requests cause the entire update to fail." Fix: validate first, quarantine failures, write the rest.
  • The credential reads the whole Drive. Someone granted drive because it worked first. Google labels drive.file recommended and non-sensitive, scoped to "only the specific Google Drive files you use with this app." Fix: drive.file, re-authorized against the one spreadsheet.
  • It stops on a Tuesday and nobody notices. Apps Script emails a failure summary from noreply-apps-scripts-notifications@google.com to whoever created the trigger. That person may have left or filtered it. A run that completes with zero rows processed produces no failure at all. Fix: a heartbeat in a digest, so a missing digest is the alarm.

What the Sheets API gives you, and where it bites

Authenticate with OAuth and request the narrowest scope: spreadsheets, or spreadsheets.readonly if the automation never writes. The surface you use is small: values.get and batchGet to read, values.update and batchUpdate to write, values.append to add rows, spreadsheets.batchUpdate for structure. Writes need valueInputOption: RAW stores text as typed, USER_ENTERED parses it like the UI. Limits, checked against Google's usage limits page on 16 September 2026: 300 read and 300 write requests per minute per project, 60 per minute per user, no daily cap. Over quota returns 429, so back off exponentially.

Three gotchas matter more than the limits.

  • There is no change webhook. The only push signal is a Drive file-change notification with no row detail that expires unless renewed. Every "instant new row" trigger, in every tool, is snapshot diffing on a polling interval. Pipedream's Sheets triggers default to 15 minutes.
  • values.append can overwrite. It finds a table in your range and writes after it, so a blank spacer row above a notes block silently eats data. Set insertDataOption=INSERT_ROWS.
  • Reads omit trailing empty cells. A row of 8 columns with 3 blank comes back with 5 entries.

The sheet also tops out at 10 million cells. A formula applied to an empty million-row range gets teams there by accident.

Build the form-response handoff agent on Major

Take a sheet where a form writes responses, and each valid row must be enriched from HubSpot and reported to Slack. Here is how it runs on Major.

  • Connectors: Google Sheets with drive.file on that one spreadsheet, HubSpot read-only, Slack write on a single channel. Each credential is scoped to what its step needs.
  • The app that holds state: a managed database with a processed-rows table (row key, run id, timestamp), a quarantine table with the failure reason, and a run log. This replaces the marker you would otherwise hide in a cell.
  • Deterministic steps: read rows past the marker, validate required fields, email format and dates in code, write back in one batch, then advance the marker. No model decides what a valid email looks like 200 times an hour.
  • The agent's judgment: a company name that matches three HubSpot accounts. The agent flags it or picks with a stated reason. This is the only step that spends tokens on every ambiguous row.
  • Trigger: a scheduled workflow, because Sheets has no change webhook. Polling is what instant means here.
  • Heartbeat: the Slack digest reports processed, quarantined and failed counts every run. A missing digest means the run did not happen.
  • Governance: RBAC on who can edit the app, and an audit log so someone can say later why row 412 never reached HubSpot.

The agent reasons once about this handoff, builds the app, and the app runs it from then on. Start building free and describe the handoff in a sentence.

Which Sheets automation should you pick?

If a task is a derived column, use a formula. If one person watches the task, the macro recorder is fine. If it is a simple scheduled job with one owner, Apps Script works, as long as that owner stays and reads the email. Once the automation must remember what it processed, quarantine bad rows, retry safely and report on itself, it has outgrown a script. It needs an app.

This article does not cover multi-currency or very large sheets that belong in a real database. Those are separate problems.

Start building on Major

Build the form-response handoff agent on Major: Sheets in, HubSpot enrichment, Slack digest out, with the processed-row marker and quarantine log held in a managed database you can audit.

Related articles

Frequently asked questions

Is there a way to automate Google Sheets to automatically sort data?
Yes. Select a range, then use Data, Sort range to sort on demand. For sorting that maintains itself, wrap your data in a QUERY or SORT formula on a second tab, which re-sorts as rows arrive. For scheduled sorting of the source tab, an Apps Script time-driven trigger can call the sort each morning. The same three tiers apply to most Sheets automation.
Is there an AI that helps with Google Sheets?
Yes, in two forms. Gemini features inside Google Workspace can draft formulas and summarize a range from a prompt. Separately, agents work on a sheet through the Sheets API, reading rows, validating them, enriching them against other systems, and writing results back. The first helps you author a spreadsheet. The second runs unattended work against one on a schedule.
How can I pull data from one Google sheet to another automatically?
Use IMPORTRANGE in the destination sheet, pointing at the source spreadsheet URL and range, and authorize the connection once. It refreshes on its own. IMPORTRANGE cannot validate what arrives, log what it pulled, or run on a fixed schedule. When you need any of those, read the source through the Sheets API and write the destination yourself.
How do you stop a Google Sheets automation from processing the same row twice?
Record what you already handled, because Sheets rows have no stable identity. A cell is addressed by coordinate, so a sort or an inserted row shifts every reference and there is no natural key to deduplicate on. Either add a processed-at column the automation writes and filters on, or store the last completed position outside the sheet and advance it only after a row finishes.
How do you know when a Google Sheets automation stops working?
By default you mostly do not. Apps Script emails a failure summary to whoever created the trigger, which is easy to filter or lose when that person changes roles, and a run that completes while processing zero rows reports no failure at all. A real alert path inverts this: have the job post a heartbeat on every run, and alert when the heartbeat is missing.