# data-scraping
Google Sheets API
RUNNINGMost agent output is for machines. The Sheets API is for the rest of it: the numbers a person needs to see, filter and argue with. My agents write into spreadsheets that non-technical people read every day, under one standing rule that has never been broken: append, fill blanks, and never delete anything.
- Verdict: RUNNING. Daily appends into tables people actually read, for months, zero data lost.
- One artifact, two audiences: humans see a table, agents see an API, and it is the same document.
- Writes are append-only with a dedup key, so the recovery from any crash is simply running the job again.
- Columns are addressed by header, not position, because humans edit the sheet under the agent.
- Earns its place while a person reads it; as a database substitute it is the wrong tool.
New here? Browse the full tool list, or see what feeds these sheets: the Search Console API.
If you are deciding where agent output for humans should land, here is the operator view. GetAgentTools lists only what I actually use, with a verdict and no sponsored placements. Verdict first, then the detail.
Verdict: RUNNING. In one line: the table humans and agents co-author.
What the Sheets API is in an agent stack
Technically it is CRUD over spreadsheets: read a range, append rows, update cells, with a service account or an OAuth token doing the authenticating. Nothing about that is novel, and treating this page as API documentation would waste your time.
What earns it a review is the role. Every agent stack eventually hits the handoff problem: the work is done, the numbers exist, and the person who needs them does not read JSON or open dashboards. A spreadsheet is the one data surface that side of the table already trusts. They can sort it, filter it, annotate it and take it into a meeting, and none of that requires you to build anything. The API makes the agent a well-behaved co-author of that document instead of a report generator nobody opens.
Why the Sheets API is RUNNING in my stack
Agents append rows and fill blanks, people read, filter and correct. Append-only writes plus a dedup key made months of reruns boring, with zero data lost.
The longest-running example: a content-metrics table an agent extends every morning from a public API, thousands of rows, deduplicated on each row's key, with derived tabs a non-technical reader uses daily. Two rules make it boring in the good way. Rows are assembled in full first and appended whole, never built cell by cell in place, so a crash leaves missing rows rather than broken ones. And the dedup check means the rerun adds only what is absent, so the recovery from any crash is the same dumb move: run it again. Numbers from the Search Console reads land the same way, and a monthly reconciliation job appends its findings next to columns a person filled by hand.
That last detail decided the rules. The moment an agent shares a document with human co-authors, their edits are data too, and an agent that overwrites a range can silently destroy an hour of someone's corrections. It only has to happen once to justify a permanent rule.
The append-only rule
The standing rule, word for word from my own config: never delete, never clear, never overwrite existing data in a sheet. Read, append new rows, fill cells that are empty. A destructive operation requires a human asking for it explicitly, and even then gets confirmed twice before it runs.
The reasoning is asymmetry. A database write that goes wrong has transactions, backups and a rollback path. A spreadsheet range that gets overwritten is gone, and version history, while it exists, is a manual archaeology nobody performs in time. Appends have no such failure mode: the worst bad append is a wrong row you can see, flag and correct. The worst bad overwrite is correct data you can no longer find. When one class of mistake is visible and the other is silent, you ban the silent one outright.
This is also what makes retries safe. Gate eight of my production checklist demands that running a job twice doubles nothing, and append-plus-dedup delivers that with one extra read: the second run fetches the keys already present and adds only what is missing. Be honest about the boundary, though. Dedup on a key guarantees at-most-once insertion, not correctness of the row that got in; a row appended with wrong values stays wrong until a person corrects it, which is the humans' verb, not the agent's. The visible-mistake asymmetry pays for itself there too, but only if somebody reads the source tab and not just the aggregates built on it.
Writing into a living document
The sheet is not a file the agent owns. It is a document people edit while the agent works: columns get renamed, new ones appear, rows get sorted into a different order over lunch. An agent that wrote to column D because the value was in column D last week corrupts the table the first time someone inserts a column, and does it without an error message.
So the reading discipline mirrors the writing discipline: fetch the header row first, resolve columns by name, and treat a missing header as a hard stop rather than a guess. Position is an implementation detail of this morning's layout. Names are the contract, and when a human renames a header, a loud failure is the correct outcome, because the contract changed and someone should decide what the new one is.
Who the Sheets API is best for
Reports non-technical people actually use. Any workflow whose final reader is a person with a spreadsheet habit: reports, reconciliations, queues a human reviews, tables a team argues over. It pairs naturally with an agent doing the collection and with no-code scenariosthat already end in "add a row", and it costs nothing to operate.
When to skip the Sheets API
No human ever opens the sheet. The sheet is an interface, and an interface nobody looks at is overhead. If the data is machine-to-machine, write it to a database or a file and skip the ceremony. If rows arrive by the thousand per hour, or several writers race each other, you are using a spreadsheet as a database with no transactions, and it will teach you why databases have them.
I would also skip it for anything sensitive. A sheet gets reshared in one click, and access reviews on spreadsheets are a thing nobody does. Data minimisation applies before the append: ids and amounts travel, personal details do not.
Cost and quotas
Free, with per-minute request quotas per project and per user rather than billing. Scheduled agent traffic, a read and a batch of appends a few times a day, does not approach them. The patterns that do: polling a sheet in a tight loop instead of caching, and writing cell by cell instead of in batches. Both are design smells before they are quota problems, and fixing the design fixes the quota. Check Google's current quota documentation before building anything that polls; the current numbers live at the published limits page.
How to wire an agent to a sheet
- Decide who the agent is: a service account the sheet is shared with, or a stored OAuth token acting as a person. Prefer the service account for anything that runs unattended.
- Store the key in the same safe place as the rest of your secrets, outside the repo and outside the prompt.
- Agree the table's contract with its human readers once: what columns, what the key column is, which tab belongs to the agent and which to people.
- Write the reader first: fetch headers, resolve columns by name, fail loudly on a missing one.
- Make every write an append of a fully assembled row, with a dedup check on the key column. Test it the hard way, both halves: kill the job mid-run and rerun it, then let a write land, pretend the response was lost, and retry. No duplicates and no half-rows after either, or it does not ship.
- Leave deletion to humans, permanently. The agent's inability to destroy the table is a feature the humans can rely on, and they will.
Google Sheets API FAQ
What is the Google Sheets API?
Programmatic read and write access to Google Sheets: an agent can read ranges, append rows and update cells in the same spreadsheet a human has open in a browser tab. That shared surface is the point. The person sees a table, the agent sees an API, and it is the same document.
Is the Google Sheets API free?
Yes, there is no per-request charge. The constraint is per-minute quotas per project and per user, which an agent doing scheduled reads and appends will not notice, and a tight polling loop will. Batch your reads, cache what repeats, and the quota stops being a topic.
Should an agent use OAuth or a service account for Sheets?
A service account when the agent owns the workflow: share the sheet with the account's email and there is no browser flow at all. OAuth with a stored refresh token when the agent acts on a person's behalf across sheets already shared with that person. Both work headlessly; the difference is whose access you are borrowing.
Why should agent writes to a sheet be append-only?
Because recovery is theoretical. Deleted data in a database has backups and transactions; an overwritten range in a sheet has a version history nobody opens in time, with a human's hand-made corrections buried somewhere inside it. Appends and filling empty cells cannot destroy anything, so that is all my agents are allowed to do.
Can an agent read a sheet that humans also edit?
Yes, and it must expect edits. People rename columns, insert new ones and sort rows, so an agent that addresses cells by position breaks on the first innocent edit. Mine read the header row first and address columns by name, which survives sorting and inserted columns; a renamed header is a changed contract, and the right response to that is a loud stop, not a guess.
When is a sheet the wrong store for agent data?
When nobody human ever looks at it, when rows arrive faster than a person could read them, or when several writers hit it concurrently. At that point the sheet is a slow database with no transactions, and an actual database is less work. The sheet earns its place exactly as long as it is an interface, not a store.