# Spreadsheet

Real cells, formulas, formatting, charts and tabs.

**What it is.** Real cells, formulas, formatting, charts and tabs, made by an AI agent such as Claude Code or Codex in Artifacts (tryartifacts.com), the office for AI agents. **Ask for it** in plain words: “Make an Artifacts spreadsheet of our monthly signups from signups.csv, with a chart and a total row.” From its **More** menu it downloads as Excel (`.xlsx`), or the open tab as CSV. See one an agent made: [FY2026 operating model](/p/northwind-operating-model), eight tabs of live formulas and charts, from assumptions to cash.

> Agents read this guide with the `guide` tool, topic `sheets`, before they first make a spreadsheet. It is shown here word for word, so people and their agents work from the same method.

| | |
| --- | --- |
| Guide topic | `sheets` |
| Tools | [20 tools](/docs/reference/sheets) |

An Artifacts spreadsheet is a real Excel-style workbook (the same spreadsheet engine in every browser and
on the server): tabs, cells, Excel formulas (500+ functions, dynamic arrays, XLOOKUP, LET), formatting,
charts, tables, sort and filter, dropdowns, conditional formatting, frozen panes and merges. People edit
it live while you work; your changes appear in their tabs at once. It downloads as a real .xlsx.

## The tools

- `create_sheet`: a new workbook with its tabs and rows, or from a file someone has (`file`: an
  .xlsx, .xlsm, .xls, .xlsb, .ods, .csv or .tsv, by public URL or base64) with everything in it.
- `sheet_read_range`, `sheet_get_cell`, `sheet_inspect_workbook`: read. `sheet_read_range` gives values
  (`formulas: true` gives the formula text, `formatted: true` what people see, e.g. `$1,250`).
  `sheet_inspect_workbook` lists tabs, used ranges, charts, tables, merges, freeze, rules.
- `sheet_write_range`, `sheet_set_cell`: write values and formulas.
- `sheet_format_range`: bold, italic, underline, font, colours, fill, number format, alignment, wrap,
  borders, in one call.
- `sheet_insert_chart`, `sheet_create_table`, `sheet_sort_range`, `sheet_filter`.
- `sheet_evaluate_formula`: try a formula without writing it.
- `sheet_execute_command`: any of the spreadsheet engine's 355 commands (`sheet_list_commands` finds them and
  their parameters): every ribbon and menu action — formatting, rows and columns, tabs, merges,
  dropdowns, conditional formats, names, tables, PivotTables, slicers, sparklines, charts, shapes,
  pictures, links, data tools (remove duplicates, text to columns, goal seek, solver, scenarios,
  consolidate, forecast), protection, page layout, view.
- `sheet_run_commands`: several commands in order in one call, nothing anyone else does in between
  (copy then paste special, a block of formatting). Stops at the first that fails and says which.
- `sheet_undo`: takes back your own latest change (call again for the one before) while nobody has
  changed the sheet since; it never takes back a person's work.
- `check_sheet`: run before you hand a sheet over. `render_sheet`: a screenshot of a tab as people
  see it (charts, colours, widths). `export_sheet`: download links (.xlsx, CSV).

**Which tab.** Every `sheet_*` tool takes `tab` (default: the first tab). A range that names a tab
acts there whatever `tab` says: `"'Q1 Budget'!B4:D9"`, `"Notes!A1"` (quote names with spaces).
Commands without a range — charts, pictures, shapes, frozen panes, tab colour — act on `tab`, so
give `tab` whenever the chart or setting is not on the first tab. `sheet.activate` does not carry
over to the next call; use `tab`.

**Which cells.** Every `sheet_*` tool also takes `selection` ("B2:D9", areas with commas): the cells
selected for that call. Commands that work on the selection — paste and paste special, fill, flash
fill, table and PivotTable commands, sort or filter without a range — act there. Copy and paste:
`sheet_run_commands` with `edit.copy` (`selection` = the source) then `edit.paste` or
`edit.pasteSpecial` `{what: "values"}` (`selection` = the top-left target cell).

Not available on the server: spelling (`review.spelling` needs the computer's word list) and
the spreadsheet engine's own windows, files and screenshots (Artifacts has `create_sheet` with a file,
`export_sheet` and `render_sheet` for those).

## Order of work

1. Plan the tabs. A reader opens the first tab, so lead with the summary or the main table; put raw
   data, inputs (assumptions) and workings on their own tabs.
2. `create_sheet` with every tab's rows: a header row, then the data, then totals. Formulas start with `=`.
3. Shape it: `sheet_format_range` (header, number formats, borders), then commands for structure:
   - freeze the header: `view.freezePanes` `{sheet, cell: "A2"}` (rows above and columns left of the cell)
   - column widths: `home.columnWidth` `{sheet, cols: "B:E", width: 110}` (pixels), or
     `home.autofitColumnWidth` `{sheet, cols}`
   - merge a title: `home.mergeCells` `{range}`; tab colour `sheet.tabColor`; new tab `home.insertSheet`
     `{name}`; rename `sheet.rename` `{sheet, name}`
4. Help people fill it in and spot exceptions:
   - dropdown: `data.validation` `{range, type: "list", formula1: "\"Planned,Committed,Spent\"",
     dropdown: true, errorStyle: "stop", errorMessage}`; numbers: `type: "decimal"` with `operator` and
     `formula1`/`formula2`
   - highlight: `home.conditionalFormat` `{range, rule: {type: "cellIs", operator: "greaterThan",
     value: "Inputs!$B$1", style: {font: {bold: true, color: "#B91C1C"}, fill: "#FEE2E2"}}}`; also
     `containsText` (`text`), `expression` (`formula`), `colorScale` (`colors`), `dataBar` (`color`)
5. `check_sheet`, fix what it finds, check again. `render_sheet` each tab you changed (and `range`
   on each chart) and look at it the way the reader will. Hand it over with the link.

Read the parameters of any command with `sheet_list_commands` `{search: "freeze"}` before you guess them.

## Values and formulas

- Write numbers as numbers (`1250`, `0.15`), not text (`"$1,250"`, `"15%"`): the look comes from the
  number format. A typed string is read the way Excel reads typing (`"15%"` becomes 0.15), so text
  that must stay text, like an ID `00123`, needs a leading apostrophe: `"'00123"`.
- Labels that look like dates or numbers are read as them: `"Jan-27"` becomes a date serial. For a
  month column either write real dates (`"2027-01-01"`) with the number format `"mmm-yy"`, or text
  with an apostrophe (`"'Jan-27"`) — a chart then uses them as categories, not as a data series.
- Compute, don't type results: totals are `=SUM(B2:B13)`, growth is `=C2/B2-1`, a lookup is a formula.
  When a source number changes, every result follows.
- Put each assumption (a rate, a price, a cap) in its own labelled cell and point formulas at it with an
  absolute reference (`=B5*Inputs!$B$2`), instead of writing the number into many formulas.
- `sheet_read_range` gives dates as their serial numbers (46388 is 2027-01-01); add
  `formatted: true` to read them as people see them.
- Test two or three formulas (`sheet_read_range` with `formatted: true`, or `sheet_evaluate_formula`)
  before you fill a whole grid: an error-free formula can still point at the wrong row.
- `check_sheet` shows any `#NAME?` (unknown function or name), `#REF!`, `#DIV/0!` with the formula behind it.

## Formatting that reads as professional

- **Header row:** bold, a light fill (e.g. `#F4F4F5`) or a bottom border; freeze it on any table longer
  than a screen. Freeze the label column too on wide tables.
- **Number formats:** one per column, and consistent: money `"$#,##0"` or `"$#,##0.00"`, negatives in
  brackets `"$#,##0;($#,##0)"`, counts `"#,##0"`, ratios `"0.0%"` (stored as 0.15), dates `"yyyy-mm-dd"`
  or `"mmm d, yyyy"`. Years as text (`"'2026"`), so a number format never shows them as `2,026`.
- **Totals:** a totals row with `SUM`, bold, a top border (`borders: {preset: "top", style: "medium"}`).
- **Column widths:** wide enough for the longest value; `check_sheet` says when a number shows as `####`.
- **Colour sparingly:** one fill for headers, one convention for inputs (blue font or a pale yellow fill
  for cells people should edit, black for formulas), conditional formatting only for exceptions.
- Avoid merged cells inside a data table: they break sorting and selecting. Merge only titles above a table.
- **Charts:** `sheet_insert_chart` with the range including its header row and labels column; give it a title.
  Columns that are not side by side: the labels column, then each series column as its own area, all
  over the same rows and each with its header: `A1:A7,D1:D7,E1:E7,F1:F7`, never `A1:A7,D1:F7` (a
  multi-area chart takes one column per area). The labels column holds text; areas carry no tab
  name, `tab` gives it.
  Columns that aren't side by side go in as areas: `"A4:A10,E4:E10"` (labels, then values).
  The chart is placed on the tab its range is on. To show it on another tab, `chart.move`
  `{chart, sheet: "Summary"}` with `tab` set to the tab the chart is on now. `sheet_inspect_workbook`
  lists each chart under `objects` with its id, type, titles and series (name, values, categories);
  `render_sheet` with `range` near the chart shows how it looks.

## Comments

People comment on a cell, a range or an object (a chart, picture or shape); it is highlighted on the
grid and listed in the comments panel. `list_comments` shows each with its tab and its `cell`
(`"B4"`, `"B4:D9"`) or object (`id`, `label`). Make the change, then `reply_comment` (and resolve).

To start a thread yourself, `comment` with `tab` and either `cell` (a cell or range) or `object_id`
(from the `objects` list of `sheet_inspect_workbook`). Comments in Artifacts sit beside the workbook; the
`review.newComment` and `review.newNote` commands write Excel notes into the file instead, which
the comments panel does not show.

## The spreadsheet engine's own instructions

What the spreadsheet engine itself tells an agent, word for word. Here its tools carry the `sheet_` prefix and take the sheet's `item_id` (`write_range` is `sheet_write_range`, `execute_command` is `sheet_execute_command`), and Artifacts keeps the file: for `open_workbook` use `create_sheet`, for `save_workbook` use `export_sheet`, for `undo` use `sheet_undo` (there is no redo).

The spreadsheet engine is a spreadsheet app (an Excel clone). Cells use A1 notation ("B2", "A1:D10", "Sheet2!A1:B3"). Every action is a command: find ids and parameters with list_commands and run any of them with execute_command. Convenience tools cover the common flow: write_range / set_cell to enter values and formulas (strings starting with = are formulas), read_range / get_cell to read computed values back, format_range, create_table, insert_chart, sort_range, filter, evaluate_formula (try a formula without changing the sheet), undo / redo, open_workbook / save_workbook. inspect_workbook summarizes sheets, used ranges, tables, charts and names. list_functions lists the worksheet functions. Backend: headless (in-process engine, no window).

## See it in use

- **Roles:** [AI for financial analysts](/roles/financial-analyst), [AI for lawyers](/roles/lawyer), [AI for sales managers](/roles/sales-manager), [AI for marketing managers](/roles/marketing-manager), [AI for operations managers](/roles/operations-manager), [AI for chief executives](/roles/chief-executive)
- **Articles:** [AI for Finance Teams: Build a Budget and Runway Dashboard](/blog/ai-for-finance-teams), [Best AI for Excel in 2026: 6 Tools Compared](/blog/best-ai-for-excel), [Budget Template: A Simple Monthly Budget, With an Example](/blog/budget-template), [Build a Dashboard With Claude Code](/blog/claude-code-dashboard), [How to Make Claude Code Create Excel and PowerPoint Files](/blog/claude-code-excel-powerpoint), [Google Sheets and Excel MCP Servers Compared (2026)](/blog/google-sheets-excel-mcp)
- **Examples:** [24 pages agents made for a sample company](/examples)
