Skip to content

Workbook editor operations via the API

The editor API can restructure columns, copy sheets within a workbook, read and edit named ranges, formatting and data validation.

Start with the API overview. Get sheetId and revision from GET /workbook. The addresses below extend /sheets/{sheetId}.

Send writes from a server. Every write body needs an idempotencyKey. To apply a change only to the version you read, pass that revision in If-Match, for example If-Match: "42".

Request Right Body or parameters Result
POST /columns/insert structure {"at":2,"count":1} Revision
POST /columns/delete structure {"at":2,"count":1} Revision
POST /copy structure and write on all sheets {"title":"Copy"} revision, copied sheet
GET /names read Optional revision revision, sheet, names with id, name, range and optional target sheetId
POST /names/upsert write {"name":"Sales","range":"B2:B10"}; include id to update revision, name
POST /names/delete write Existing name id Revision
GET /formats read range, optional revision revision, sheet, range, formats matrix
PATCH /formats write {"range":"B2:B10","format":{"bold":true}} Revision
GET /validations read Optional revision revision, sheet, rules
POST /validations/upsert write ranges, invalid, options or condition; include id to update revision, rule
POST /validations/delete write Existing rule id Revision

To reject amounts below zero, send:

{
"idempotencyKey": "amount-rule-001",
"ranges": ["B2:B10"],
"invalid": "reject",
"condition": {"kind": "number", "op": "gte", "values": ["0"]}
}

In a batch, use columns-insert, columns-delete, sheet-copy, name-upsert, name-delete, format, validation-upsert and validation-delete. The action’s data has the single-operation fields without idempotencyKey. With sheet-copy, ref lets the next action address the copy through sheetRef.

  • Column numbers start at 1. Insert before at; use at = cols + 1 to add columns on the right. A sheet must keep 1 to 999 columns. Formulas, names and rules shift according to workbook rules.
  • Each read uses one revision. When reading metadata and cells together, pass the same revision to every request. A key sees only its permitted visible sheets. A copy stays in the same workbook, and photo links remain within that workbook.
  • Named-range writes are limited to the current sheet. Reads return valid ranges with visible targets. Named functions are not available through these operations.
  • Formatting uses an A1 cell or rectangle within the sheet. Reads combine row, column and cell formatting, including empty formatted cells. null in the matrix means no formatting. format: null clears formatting in the selected area according to workbook rules. Formatting a rectangle preserves stripe formatting; formatting a whole row, column or sheet changes its stripe. A null field in a patch clears that field.
  • invalid is reject or warn. A rule can cover up to 100 non-overlapping A1 ranges on the current sheet and have up to 500 options of {id,value,color?}. List rules need non-empty options; keep option UUIDs when changing labels to preserve existing cell selections. multiple defaults to false; display defaults to text and also accepts chip or arrow; help can be up to 500 characters.
  • A sheet can have up to 1,000 rules. At the limit, update or delete existing rules. When changing labels, the resulting text for each saved selection must fit within 5,000 UTF-16 code units; the total new label text also counts toward the workbook size limit.
  • Supported validation types are checkbox, number, date and text. New number bounds must be finite decimal strings with a dot; new date bounds must be valid YYYY-MM-DD calendar dates from 1900 onward. between and notBetween take two bounds; other number/date comparisons take one. date.valid, text.email and text.url take an empty array. Formula-backed rules and formula bounds are not exposed or editable through the API.
  • Reads normalize existing saved bounds when the meaning can be preserved: for example, 1,5 becomes 1.5, and 31.01.2026 or that date’s serial becomes 2026-01-31. Rules with date bounds that cannot be represented as valid ISO dates remain unavailable through the API. Existing supported rules can be updated or deleted by their original ID.
  • Format reads and writes cover up to 10,000 cells. A copy includes up to 10,000 saved cells. Copying, formatting and changing labels of selected options count toward a batch’s shared 10,000-cell limit.
  • Operation bodies are limited to 64 KiB; setting a rule is limited to 512 KiB. Batches have their own limit. Workbook metadata and editor responses are each limited to 8 MiB. Before building a workbook for an operation, checks allow up to 250,000 stored cell records and 32 MiB of input, including possible growth while replaying an old journal. The output workbook document is limited to 32 MiB.
Response What to do
400 Check fields, If-Match syntax, and the number and types of bounds.
403 Check the key’s rights and protection on both the source and destination ranges.
404 Check access to the sheet, range ID or rule ID.
409 revision_conflict, 412 revision_conflict Read the sheet again with its current revision. Use a new idempotency key for a changed write.
409 idempotency_conflict Use a different idempotencyKey for a different write.
413 Reduce the rectangle, batch or workbook size. If saved metadata already exceeds the limit, use the workbook editor or a smaller workbook.
422 Check the range or column bounds. For invalid_value, shorten the resulting label for selected options.
429, 503 Retry after Retry-After. If the write outcome is unknown, retry with the same body, If-Match and idempotency key.