Skip to content

Workbook changes via the API

The changes feed helps update a local copy of a workbook after edits by its owner, a guest or an API key. It returns revision numbers and change effects. It does not include values, formulas or author details.

The key needs the read right. After the initial read of the workbook and its sheets, save the shared revision. Pass that revision in revision when reading multiple pages.

Окно терминала
curl -H "Authorization: Bearer $KEY" "$BASE/changes?since=412&limit=100"
{
"revision": 414,
"changes": [{"revision": 413, "effects": [{"kind": "rows_deleted", "sheetId": "452583b9-a8d4-45f0-9293-4f89c6b92403", "row": 3, "count": 2}]}],
"next": null,
"reset": false
}
  • since is exclusive; until is inclusive. If you omit until, the server pins the first page to the current revision.
  • While next is not null, send it as since and the first page’s revision as until. Hidden events still advance the cursor, so changes can be empty.
  • When next is null, save revision as the starting point for the next read. If needed, read current values from rows or values at that revision.
Effect What to do
cells_changed Read the A1 ranges in ranges from sheet sheetId.
rows_inserted, rows_deleted Apply the row shift starting at row by count rows. Row numbers start at 1; the position is relative to the state before the effect.
sheet_added, sheet_refresh Read the sheet again by sheetId.
sheet_removed Remove the sheet from the local copy. This means a previously visible sheet was deleted or hidden.
workbook_refresh Read the sheet list and data again. This can follow recovery, a complex edit or formula recalculation.

Ordinary effects are limited to visible sheets the key can access. A hidden or deleted sheet marker contains only the ID of a previously visible, accessible sheet; the feed does not reveal values, sheet names or authors. Unknown, broad or formula-dependent effects can require sheet_refresh or workbook_refresh; do not assume an exact cell range is available.

Each page scans up to 200 revisions, with a default of 100. Revisions without visible effects still count toward this limit. History is available for no more than 24 hours and within the workbook’s latest 10,000 revisions.

  • 200 reset: true means the requested history expired, has a gap or is unsupported. Read the workbook and its sheets again, then continue from the new revision.
  • 400 invalid_request means the parameters are malformed, since > until, or limit is outside 1 to 200.
  • 409 revision_conflict means the requested revision is in the future; the response contains the current revision. Check the local copy and start the read again.
  • For 429 or 503, wait for Retry-After and retry the same request.