GridPath
v0.5.0Edit real .xlsx files with your agent: live formulas, and you review every change before it saves.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
set_cell
Set the value or formula of a single cell. `cell` is an Excel A1-style address (case-insensitive, e.g. "A1", "B17", "AA42"). For formulas, pass them in `formula` starting with '=' (e.g. "=SUM(A1:A10)") — do NOT put formulas in `value`.
| Parameter | Type | Description |
|---|---|---|
cell * | string | A1 address. Examples: "A1", "B17", "AA42". |
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
sheet * | string | Sheet name (case-sensitive). |
formula | string | null | Excel-style formula starting with '='. References inside use A1 notation. Example: "=SUM(A1:A10)". |
value | Literal value (string, number, boolean, or null). Leave null when using `formula`. |
set_range
Set a rectangular block of values starting at `top_left` (A1 address). `values` is a 2D array — outer rows, inner cells. Strings starting with '=' inside `values` are treated as formulas; formula references must use A1 notation pointing at the FINAL placement of cells (e.g. if `top_left` is "A9" and the value at row index 2 / col 0 should reference the data row just above your block at A8, write "=A8" — not "=A1" or "=A11"). **Off-by-one guard: if formulas will reference rows created by THIS call, split the work — write labels + hardcoded values first, read the `row_map` in this call's r…
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
sheet * | string | |
top_left * | string | A1 address of the top-left cell, e.g. "A9". |
values * | array | 2D array — outer = rows, inner = cells. Strings beginning with '=' are formulas. |
copy_range
Copy a rectangular range to another location with Excel copy/paste semantics, executed against the LIVE grid: relative formula references shift by the paste offset exactly like Excel ($ anchors are respected — `$B$5` stays put, `B5` shifts), and cell formatting (number format, font, fill, alignment) travels with the cells. STRONGLY PREFER this over reading a range and re-typing shifted formulas yourself — it cannot make off-by-one mistakes and costs a fraction of the tokens. Ideal for: extending a projection by one more period (copy the last full year column block to the next column), dupl…
| Parameter | Type | Description |
|---|---|---|
dest * | string | A1 address of the destination TOP-LEFT cell, e.g. "BU5". The copy lands in a rectangle of the same size starting here. |
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
sheet * | string | Source sheet name (case-sensitive). |
source * | string | A1 range to copy, e.g. "BT5:BT120" or a single cell "C7". |
dest_sheet | string | null | Destination sheet if different from `sheet`. Formula references shift the same way; sheet-qualified refs keep pointing at their original sheets. |
mode | string | "all" (default): shifted formulas + values + formats. "values": paste evaluated values only — use to freeze a calculation as hardcodes. "formats": formatting only, contents untouched. |
run_script
Execute a short JavaScript program against the workbook and land ALL its writes as one reviewable batch. STRONGLY PREFER this over long set_range payloads or many tool turns whenever the edit is loop-shaped: per-row conditional transforms ("for every row where margin < 0 …"), repeating formula patterns across many rows/columns, address arithmetic, or edits that depend on reading existing cells first. One run_script call replaces dozens of tool turns and cannot drift out of alignment mid-payload, because it computes addresses programmatically. API (plain synchronous JavaScript, strict mode â…
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
script * | string | JavaScript source, executed as a function body. Example: const s = sheet("Model"); const rows = s.values("A2:C50"); rows.forEach((r, i) => { if (r[2] !== null && r[2] < 0) s.set("D" + (i + 2), "=C" +… |
set_format
Apply formatting to one OR MANY cell ranges in a single call. STRONGLY PREFER the bulk `operations` form when you have more than one format to apply — it's one tool call instead of N, dramatically faster. Each operation's `format` is a partial object; only specified properties are applied, others are left as-is. Use this for: bold headers, currency / percent / number formatting on data columns, italic notes, alignment, font color/size/family, **text wrap via `wrap_text`** (long methodology notes / descriptions in a fixed-width column — wrap beats restructuring the layout around overflow),…
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
sheet * | string | |
format | object | Partial format (only when using single-range form). |
operations | array | Bulk form — array of {range, format} pairs. Use this whenever you have ≥2 formats to apply. Example: [{"range":"A1","format":{"bold":true,"font_size":16}},{"range":"B8:F8","format":{"number_format… |
range | string | A1 range (only when using single-range form). Examples: "A1", "B2:B10", "A1:F1". |
set_column_width
Set the pixel width of one or more columns. **Always prefer the bulk `operations` form when you need multiple widths** (e.g. label column A wide, data columns narrower) — one call instead of N. The flat single-width form is kept for trivial cases. Default Excel column is ~64px; a wide column for labels is typically 180–220.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
sheet * | string | |
columns | string | Single-op form (omit `operations`). Comma-separated column letters. |
operations | array | Bulk form. Each entry sets a width on a group of columns. Use this when you need different widths for different column groups. |
width | number | Single-op form pixel width. |
set_row_height
Set the pixel height of one or more rows. **Always prefer the bulk `operations` form when you need multiple heights** (e.g. title row tall, body rows short) — one call instead of N. The flat single-height form is kept for trivial cases. Default row is ~24.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
sheet * | string | |
height | number | Single-op form pixel height. |
operations | array | Bulk form. Each entry sets a height on a group of rows. |
rows | string | Single-op form (omit `operations`). Comma-separated 1-indexed row numbers. |
merge_cells
Merge a rectangular range into a single visible cell (e.g. for section headers). `range` is an A1 range like "A1:F1".
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
range * | string | |
sheet * | string |
unmerge_cells
Unmerge a previously merged range.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
range * | string | |
sheet * | string |
set_note
Attach a note (Excel-style cell comment) to a single cell — a small indicator that shows the given text on hover. Use this for methodology callouts, source citations, or caveats that would clutter the cell's own value. Overwrites any existing note on that cell.
| Parameter | Type | Description |
|---|---|---|
cell * | string | A1 address, e.g. "B7". |
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
sheet * | string | |
text * | string |
delete_note
Remove a cell's note, if it has one. No-op if the cell has no note.
| Parameter | Type | Description |
|---|---|---|
cell * | string | A1 address, e.g. "B7". |
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
sheet * | string |
create_sheet
Create a new sheet (worksheet tab) in the workbook. Use a clear human-readable name like "Assumptions", "Q4 2024", "Inputs". The new sheet starts empty — write cells with set_cell / set_range afterwards. NOTE: writes to a not-yet-existing sheet name auto-create it, so an explicit create_sheet is only needed when you want to set a tab_color or create an empty tab ahead of time.
| Parameter | Type | Description |
|---|---|---|
name * | string | Sheet name (must be unique in the workbook). |
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
tab_color | string | null | Optional CSS color for the tab, e.g. "#22c55e". |
delete_sheet
Remove a sheet from the workbook. Permanent — every cell on this sheet is lost. Cross-sheet references in other sheets will become #REF!.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
rename_sheet
Rename a sheet. Cross-sheet formula references in other sheets will be updated automatically by the workbook engine.
| Parameter | Type | Description |
|---|---|---|
new_name * | string | |
old_name * | string | |
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
clear_range
Empty the values AND formulas of cells in `range`. Use this when you want to delete content (not just overwrite with new values). `range` is an A1 range like "A1", "A1:F1", or "B2:D10". Cell formatting is preserved.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
range * | string | |
sheet * | string |
insert_rows
Insert `count` empty rows starting at (and shifting down from) row `before` (1-indexed Excel row number). Existing content at row `before` and below shifts down. Use this to make space in the middle of a model. Charts and conditional-formatting references in unrelated areas of the workbook may not auto-adjust to the new layout.
| Parameter | Type | Description |
|---|---|---|
before * | integer | 1-indexed row number to insert before. |
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
sheet * | string | |
count | integer |
delete_rows
Delete `count` rows starting at row `start` (1-indexed). Content below shifts up. Permanent — the removed rows are gone.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
sheet * | string | |
start * | integer | |
count | integer |
insert_columns
Insert `count` empty columns starting at (and shifting right from) column `before` (column letter like "C"). Existing content shifts right.
| Parameter | Type | Description |
|---|---|---|
before * | string | Column letter to insert before, e.g. "C". |
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
sheet * | string | |
count | integer |
delete_columns
Delete `count` columns starting at column `start` (column letter like "C"). Content to the right shifts left. Permanent.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
sheet * | string | |
start * | string | |
count | integer |
freeze_panes
Freeze the top `rows` rows and left `cols` columns of a sheet so they stay visible while scrolling. Classic financial-model setup is `freeze_rows: 1, freeze_cols: 1` (lock the header row and label column). Pass 0 to disable that axis.
| Parameter | Type | Description |
|---|---|---|
freeze_cols * | integer | Number of left columns to freeze. |
freeze_rows * | integer | Number of top rows to freeze. |
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
sheet * | string |
unfreeze_panes
Remove any freeze panes from a sheet.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
sheet * | string |
hide_rows
Hide one or more rows. `rows` is a comma-separated list of 1-indexed row numbers (e.g. "3" or "3,5,12"). Hidden rows still hold data but don't display in the workbook.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
rows * | string | Comma-separated 1-indexed row numbers. |
sheet * | string |
show_rows
Unhide one or more rows. Same `rows` format as hide_rows.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
rows * | string | |
sheet * | string |
hide_columns
Hide one or more columns. `columns` is a comma-separated list of column letters (e.g. "D" or "D,F,H").
| Parameter | Type | Description |
|---|---|---|
columns * | string | Comma-separated column letters. |
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
sheet * | string |
show_columns
Unhide one or more columns. Same `columns` format as hide_columns.
| Parameter | Type | Description |
|---|---|---|
columns * | string | |
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
sheet * | string |
read_range
Read evaluated cell values from a specific A1 range WITHOUT modifying anything. Use this to verify your own work, confirm where the assumption block actually landed before composing dependent formulas, or pull current values you need to reference. Returns each non-empty cell's value AND formula (if any) in `A1 = value` form. Costs one tool turn but is the cheapest way to prevent the formula-pointing-at-wrong-row class of bug on long sheets. Range limited to 500 cells per call. To LOCATE a row/section/header by NAME, don't probe with this — use `find_rows` or `describe_workbook` first, then r…
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
range * | string | A1 range, e.g. "G45:K45", "A1:Z10", or a single cell "B7". |
sheet * | string | Sheet name (case-sensitive). |
describe_workbook
Get a structural map of the ACTIVE workbook without reading cell data. Per sheet: the used range, the detected header row with its period/column headers mapped to column letters (e.g. {"BU": "FY2026E"}), and a table of contents of sections — contiguous row bands with their titles, like {"rows": "5-42", "title": "Revenue build"}. Also lists workbook defined names. Served from an in-memory index, so it's near-instant and returns in ONE call what would take many read_range probes. Call it once to orient on any sheet whose preview is truncated. Optional `sheet` filters to a single sheet.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
sheet | string | Optional: limit the map to this sheet (case-sensitive). |
find_rows
Search the ACTIVE workbook's row labels and column headers by name and get exact positions back — e.g. query "total revenue" returns each matching row's sheet, 1-indexed row number, containing section, and one evaluated sample cell ("BT209 = =BT194 → 39001.1") read live from the grid. Matching is case-insensitive substring plus word-prefix ("tot rev" matches "Total revenue"). Near-instant. Use this — NOT exploratory read_range probes — whenever you need to LOCATE a row or header ("where is Subscriber ARPU?", "which column is FY2027E?"); then read_range the exact range you need. Searche…
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
query * | string | Label text to find, e.g. "total revenue". |
max_results | integer | Max matches to return (default 20). |
sheet | string | Optional: search only this sheet (case-sensitive). |
query_rows
Filter, project and aggregate the rows of ONE sheet of the ACTIVE workbook by column values — served by the calculation engine in milliseconds on any sheet size. This is the tool for "which rows have Acme in the Owner column", "stores with revenue >= 100 opened after 2026-01-01", or "total revenue by region": one call, instead of scanning with read_range or writing a script. Columns are column letters ("DB") or header texts from the sheet's header row ("Revenue ($m)", case-insensitive, unique substrings accepted); the header row is auto-detected (override with `header_row`). `where` lists pr…
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
sheet * | string | Sheet name (case-sensitive). |
aggregate | array | With group_by: aggregates to compute per group (e.g. sum of Revenue). Groups are ordered by the first aggregate, descending. |
columns | array | Columns to return (letters or header texts). Default: the header-row columns, up to 40. |
end_row | integer | Last data row to scan (default: the sheet's last row). |
group_by | string | Group matching rows by this column's value and return one entry per value instead of rows. |
header_row | integer | 1-indexed header row, when auto-detection picks the wrong one. |
include_formulas | boolean | Return {v, f} for formula cells instead of the bare value. |
limit | integer | Max rows (or groups) to return. Default 50. |
order_by | object | Sort matches by a column before applying `limit` (numbers before text, blanks last). |
start_row | integer | First data row to scan (default: the row after the header). |
where | array | Predicates, all of which must hold. Omit for every row. |
define_name
Create (or replace) a workbook-scoped named range so formulas can reference a cell/range by a readable name instead of a raw address — e.g. name `GrowthRate` for the assumption cell, then write `=Revenue*(1+GrowthRate)`. The name persists in the saved .xlsx. `name` must be a valid Excel name (letters, digits, underscores; can't look like a cell reference such as "A1"). `ref` must be sheet-qualified, e.g. "Model!B22" or "Model!B5:B12" (absolute `$` signs optional — they're added automatically). Calling again with the same `name` replaces its target.
| Parameter | Type | Description |
|---|---|---|
name * | string | Defined name, e.g. "GrowthRate" or "Revenue". Must not look like a cell address. |
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
ref * | string | Sheet-qualified target, e.g. "Model!B22" or "Assumptions!B5:B12". |
sheet | string | Optional. Only needed if `ref` is a bare range without a sheet prefix; supplies the sheet for it. |
list_batches
List this workbook's pending (unsaved) change batches with their mutation counts, and the review link.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
reject_batch
Drop one pending batch. The remaining batches are replayed onto a fresh model, so later edits that depended on it may change.
| Parameter | Type | Description |
|---|---|---|
batch_id * | string | |
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
save_workbook
Write every pending batch into the .xlsx on disk through the surgical patcher: only the parts an edit touched are rewritten, everything else stays byte-identical. This is the ONLY tool that modifies the file. When the server runs with --review-required, this returns the review link instead and the user saves from there.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .xlsx to operate on (absolute, or ~/… for the user's home directory). |
as | string | Optional: write the result to this path instead (a copy), leaving the original untouched. Pending batches stay pending against the original. |