> ## Documentation Index
> Fetch the complete documentation index at: https://docs.macro.com/llms.txt
> Use this file to discover all available pages before exploring further.

# EditSpreadsheet

> Apply one atomic batch to a native Macro spreadsheet: set cell values/formulas, format or clear ranges, fill with relative formulas, add rows, resize columns, or add/rename/duplicate/delete sheets. Requires expectedRevision from a fresh ReadSpreadsheet. If the workbook changed, nothing is written: reread and reconsider, never blindly retry. All operations validate before saving; at most 25 operations and 2000 affected cells. Sheet IDs are stable; an exact sheet name may address a sheet added earlier in the same batch. Existing directly referenced sheets cannot be renamed/deleted, and the last sheet cannot be deleted. Read affected ranges after editing to verify computed results. Formula errors are returned as warnings, not silently repaired.

# EditSpreadsheet

Apply one atomic batch to a native Macro spreadsheet: set cell values/formulas, format or clear ranges, fill with relative formulas, add rows, resize columns, or add/rename/duplicate/delete sheets. Requires expectedRevision from a fresh ReadSpreadsheet. If the workbook changed, nothing is written: reread and reconsider, never blindly retry. All operations validate before saving; at most 25 operations and 2000 affected cells. Sheet IDs are stable; an exact sheet name may address a sheet added earlier in the same batch. Existing directly referenced sheets cannot be renamed/deleted, and the last sheet cannot be deleted. Read affected ranges after editing to verify computed results. Formula errors are returned as warnings, not silently repaired.

## Parameters

| Parameter          | Type                    | Required | Description                                          |
| ------------------ | ----------------------- | -------- | ---------------------------------------------------- |
| `documentId`       | string                  | Yes      | Native spreadsheet document ID.                      |
| `expectedRevision` | string                  | Yes      | Exact opaque revision returned by ReadSpreadsheet.   |
| `operations`       | SpreadsheetOperation\[] | Yes      | Ordered operations validated and committed together. |
