Workbook changes via the API
What it does
Section titled “What it does”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.
How to use it
Section titled “How to use it”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}sinceis exclusive;untilis inclusive. If you omituntil, the server pins the first page to the current revision.- While
nextis notnull, send it assinceand the first page’srevisionasuntil. Hidden events still advance the cursor, sochangescan be empty. - When
nextisnull, saverevisionas the starting point for the next read. If needed, read current values fromrowsorvaluesat that revision.
Limitations
Section titled “Limitations”| 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.
If something goes wrong
Section titled “If something goes wrong”200 reset: truemeans 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_requestmeans the parameters are malformed,since > until, orlimitis outside1to200.409 revision_conflictmeans the requested revision is in the future; the response contains the currentrevision. Check the local copy and start the read again.- For
429or503, wait forRetry-Afterand retry the same request.
