Skip to content

Share a Google Sheet (as shared data your agent can read and write)

Hand someone a spreadsheet — view, comment, or edit — and let your agent keep it updated or pull figures out of it by code. Sharing works exactly like a Google Doc; the agent angle is the Sheets API. There's also a third mode: publish a read-only CSV that any app (or your agent) can pull on a plain link.

Time: the share itself is one click (or one sentence to your agent). Two un-delegable bits: a recipient with no Google account can only view (commenting and editing need one), and the agent's read/write path needs a Google Cloud project + credentials wired once — ~10 min, the same one-time setup any Google API CLI needs. [confirmed] Last verified: 2026-06-07 · the Share dialog and roles come from Google Drive Help; the API read/write, scopes, and Publish-to-web from Sheets API docs and Google Docs Help. [confirmed]

Before you begin

  • A Google account, signed in to the sheet you want to share. Sheets live at sheets.google.com.
  • The recipient's email — only if you're sharing with named people (the "Restricted" path). The "anyone with the link" path needs no email at all.
  • For the agent read/write path only: a Google Cloud project with Sheets API credentials — a service-account key (or an OAuth token). This is a one-time browser setup of ~10 min (Peter Hartree's walkthrough clocks the same Google Cloud project setup at "~10 minutes"). You don't need this just to share the sheet with people. [confirmed]

New to letting an agent drive? Start with Set up Claude Code, then How to ask your agent; come back once claude runs.

Share it with people (same dialog as a Google Doc)

In the sheet, click Share (top-right). The dialog has two halves, identical to a Doc: [confirmed]

  1. Named people (top box) — type an email, pick a role, Send. The default is Restricted: only the people you list can open it. Each gets an email with the link.
  2. General access (the dropdown below) — switch from Restricted to Anyone with the link, then pick the role. Now the link itself is the key — no Google account needed to view. (Commenting or editing via the link still needs the recipient signed in to a Google account.) [confirmed]

Click Copy link and send it wherever your recipient is.

Pick the right role — same three as a Doc: [confirmed]

  • Viewer — read and download. Can't change a cell or comment.
  • Commenter — read, download, and leave margin comments. Can't edit cells.
  • Editor — read, edit cells, add tabs, and re-share. The widest grant; hand it out deliberately.

On a work or school (Google Workspace) account, there's a middle rung. The General access dropdown usually also offers your organisation's name — "anyone in [your org] with the link" — sitting between Restricted and the fully public option. Sharing outside the org appears only if your admin allows it. [confirmed]

Let your agent read and write the sheet (the Sheets API)

This is the part a Doc share can't do: your agent reads rows and writes cells by code, so it can keep a tracker current, append results, or pull figures into a report — no copy-paste. It talks to the Google Sheets API, which "lets you read and modify a spreadsheet's data" by cell range (A1 notation, e.g. Sheet1!A1:B2). [confirmed]

Wire it up once (~10 min, the un-delegable bit): create a Google Cloud project, enable the Sheets API in it, and make a service account — Google hands you a JSON key file. Then do the one step everyone forgets: share the sheet with the service account's email (it ends in …@…iam.gserviceaccount.com) as an Editor, exactly like adding any collaborator. The service account is its own "user"; until you invite it, it can't see your sheet. [confirmed]

Then say to your agent:

Using my Sheets service-account key, read the "Tracker" tab of this sheet, append a row with today's totals, and tell me what you wrote.

Your agent calls the API with that key — no browser, no clicking. Pick the access it gets by the OAuth scope: [confirmed]

  • Read and write: https://www.googleapis.com/auth/spreadsheets
  • Read only: https://www.googleapis.com/auth/spreadsheets.readonly — use this when the agent only pulls figures, never edits.

Simpler, no Cloud project? If the logic can live inside the sheet, Apps Script (Extensions → Apps Script) reads and writes cells with the sheet owner's own authorization — getDataRange(), setValues() — no service account, no API key. Good for a scheduled tidy-up; less good when you want your local agent driving it. [confirmed]

Publish a read-only public data feed (CSV)

To expose the numbers as a feed others (or a small app) can pull — without granting edit access or sharing the editable file — publish it. Publishing is not the same as sharing: it makes a separate, view-only public copy that updates when you edit, with no toolbar and no formulas exposed. [confirmed]

File → Share → Publish to web. Choose the whole spreadsheet or a single tab, and a publishing format — including comma-separated values (.csv) — then Publish. You get a stable URL anyone can open or fetch; "any changes you make to the original document will be updated in the published version." [confirmed]

Hand your agent (or any script) that link and it pulls live rows with no auth at all:

Fetch this published CSV link every morning and chart the latest row.

There's also a no-publish export shortcut: append /gviz/tq?tqx=out:csv&gid=<tab-id> to a sheet's URL to download one tab as CSV — but the sheet must be link-shared (or published) for an outside puller to reach it. [confirmed] (the gviz export path is widely used but not documented as a stable public API — treat it as best-effort) [unclear]

If it doesn't work

  • Recipient sees "You need access" / "Request access" → the sheet is still Restricted and they're not on the list. Add their email, or switch General access to Anyone with the link. If they request access, you get an email with their name and a one-click approve. [confirmed]
  • They opened the link but can't edit a cell or comment → "Anyone with the link" lets anyone view without an account, but editing and commenting need them signed in to a Google account, and the link's role must be Editor/Commenter (not Viewer). [confirmed]
  • Agent gets 403 / PERMISSION_DENIED → almost always one of three: the Sheets API isn't enabled in the Cloud project, the scope is wrong (read-only key trying to write), or — most common — you never shared the sheet with the service-account email. Add that …iam.gserviceaccount.com address as an Editor and retry. [confirmed]
  • Agent gets 401 / "invalid credentials" or logs out after a week → the key/token is bad or expired. A service-account key doesn't expire, but an OAuth app left in "testing" mode logs you out every 7 days — publish the app. (A critical step agents miss, per Hartree.) [confirmed]
  • "I published it but my collaborator still can't edit"publishing ≠ sharing. Publish-to-web makes a read-only public copy; it grants nobody edit access to the real file. To let someone change cells, use the Share dialog and the Editor role. [confirmed]
  • "I shared it but the public CSV link 404s / is empty" → sharing the editable file doesn't create a feed. You must Publish to web (and pick CSV) to get a public data URL; the gviz export needs the sheet link-shared too. [confirmed]
  • "Anyone with the link" is greyed out, or only your org appears → a work/school (Workspace) admin has restricted external sharing; you may only be able to share inside your domain. Ask the admin, or use a personal Google account for fully public sharing. [confirmed]

Prefer to do it all by hand?

  1. Open the sheet → Share (top-right). Named people: type emails, set a role, Send. Or link: under General access, switch to Anyone with the link (or your org's name on Workspace), set the role.
  2. Copy link → send it.
  3. For a public CSV feed: File → Share → Publish to web → pick the tab (or whole sheet) and .csvPublish → copy the link.
  4. For agent read/write: in Google Cloud Console, make a project, enable the Sheets API, create a service account, download its JSON key, and share the sheet with the service-account email as Editor. [confirmed]

Watch / read

Best written walkthrough: Google's own Share files from Google Drive for the Restricted-vs-link dialog and the three roles, paired with Publish a file from Google Drive for the Publish-to-web / CSV path. For the agent angle, the Sheets API concepts and reading & writing values guides are authoritative on A1 ranges, scopes, and batch read/write. [confirmed]

Short videos (titles/channels/durations are the signal — YouTube transcripts couldn't be verified from this machine this session):

Other ways to share

  • It's really just prose people read or mark up, not tabular data? → a Google Doc opens in one tap, no account to view, comments in the margin.
  • You want a whole bundle — sheets, docs, PDFs — behind one link?share a Google Drive folder; new files dropped in inherit the same sharing.
  • They'll build on it as code, with every version tracked? → a GitHub repository hands over the whole project and records who changed what.

Sources

  • Share files from Google Drive — Google Drive Help (Share dialog, Viewer/Commenter/Editor, Restricted vs Anyone-with-link, no-account viewing, work/school external-sharing limits) — checked 2026-06-07
  • Publish a file from Google Drive — Google Docs Editors Help (File → Share → Publish to web, whole spreadsheet or individual sheets, CSV format, published copy updates with edits, view-only no-formulas) — checked 2026-06-07
  • Learn more about access to Google files — Google Docs Editors Help (the "You need access" / Request access flow and the owner's one-click approval email) — checked 2026-06-07
  • Sheets API — Concepts overview — Google Sheets API (RESTful read/modify of spreadsheet data, A1 notation) — checked 2026-06-07
  • Sheets API — Read & write cell values — Google Sheets API (values.get / values.update / batch, ranges) — checked 2026-06-07
  • OAuth 2.0 Scopes for Google APIs — Google Identity (spreadsheets for read/write, spreadsheets.readonly for read) — checked 2026-06-07
  • spreadsheets.values.get reference — Google Sheets API (authorization scopes incl. spreadsheets.readonly) — checked 2026-06-07
  • Sheet class — Google Apps Script (getDataRange, getRange/setValues, runs with the user's own authorization, no separate credentials) — checked 2026-06-07
  • Google Cloud Console setup for CLI tools — Peter Hartree (the Google Cloud project + credentials setup is "~10 minutes"; OAuth apps left in "testing" log you out every 7 days — publish the app) — (unofficial — wow.pjh.is journal, seen 2026-06-07)
  • Permission-denied with a Sheets service account — googlesheets4 issue (403 when the sheet isn't shared with the service-account email; share it as a collaborator) — (unofficial — GitHub issue, seen 2026-06-07)