Skip to content
Agent Tools

editCells

Permanently write values or formulas to cells. Merge or unmerge cells.

IMPORTANT: After editing, you MUST call readCalculatedValues to see the resulting changes. The tool returns a delta showing changes, but you should verify formulas propagated correctly.

Writing text over a cell that held a number or date is reported in warnings (level “high” or “low”). A “high” warning usually means a real value was turned into a text string that only looks the same — write the value itself, not its displayed text.

Examples:

  • Set value: { “apply”: [{ “target”: “A1”, “value”: 100 }], “note”: “Set initial value” }
  • Set formula: { “apply”: [{ “target”: “B1”, “value”: “=A1*2” }], “note”: “Add formula” }
  • With style: { “apply”: [{ “target”: “A1”, “value”: 100, “styleIndex”: 0 }], “styles”: [{ “bold”: true }], “note”: “Bold value” }
  • Merge cells: { “apply”: [], “merge”: [“A1:B2”], “note”: “Merge header” }
  • Unmerge: { “apply”: [], “unmerge”: [“A1:B2”], “note”: “Unmerge cells” }

Formulas must start with ”=”. Values are auto-detected as number, boolean, or string.

ParameterTypeDescription
applyobject[]requiredArray of cell edits to apply
apply[].targetstringrequiredCell reference (e.g., “A1”, “Sheet1!B2”)
apply[].valuestring | number | boolean | nulloptionalValue or formula to write. Formulas start with ”=”. Omit to only apply style.
apply[].styleIndexnumberoptionalIndex into the styles array to apply
stylesobject[]optionalArray of style objects referenced by styleIndex in apply items
styles[].boldbooleanoptionalBold text
styles[].borderBottomColorstringoptionalBottom border color
styles[].borderBottomStyle"none" | "dashDot" | "dashDotDot" | "dashed" | "dotted" | "double" | "hair" | "medium" | "mediumDashDot" | "mediumDashDotDot" | "mediumDashed" | "slantDashDot" | "thick" | "thin"optionalBottom border style
styles[].borderLeftColorstringoptionalLeft border color
styles[].borderLeftStyle"none" | "dashDot" | "dashDotDot" | "dashed" | "dotted" | "double" | "hair" | "medium" | "mediumDashDot" | "mediumDashDotDot" | "mediumDashed" | "slantDashDot" | "thick" | "thin"optionalLeft border style
styles[].borderRightColorstringoptionalRight border color
styles[].borderRightStyle"none" | "dashDot" | "dashDotDot" | "dashed" | "dotted" | "double" | "hair" | "medium" | "mediumDashDot" | "mediumDashDotDot" | "mediumDashed" | "slantDashDot" | "thick" | "thin"optionalRight border style
styles[].borderTopColorstringoptionalTop border color
styles[].borderTopStyle"none" | "dashDot" | "dashDotDot" | "dashed" | "dotted" | "double" | "hair" | "medium" | "mediumDashDot" | "mediumDashDotDot" | "mediumDashed" | "slantDashDot" | "thick" | "thin"optionalTop border style
styles[].fillColorstringoptionalCell background color as hex code
styles[].…+ 11 more properties
notestringrequiredDescription of this edit for version history
mergestring[]optionalArray of ranges to merge (e.g., [“A1:B2”, “D4:E6”]). Each range must span at least 2 cells.
unmergestring[]optionalArray of ranges to unmerge. Can specify exact merged range or any cell within a merge.