GridPath

v0.5.0
io.github.pixelsmasher13/gridpath Checked 52 minutes ago Published 1 month ago

Edit 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`.

ParameterTypeDescription
cell *stringA1 address. Examples: "A1", "B17", "AA42".
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
sheet *stringSheet name (case-sensitive).
formulastring | nullExcel-style formula starting with '='. References inside use A1 notation. Example: "=SUM(A1:A10)".
valueLiteral 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…

ParameterTypeDescription
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
sheet *string
top_left *stringA1 address of the top-left cell, e.g. "A9".
values *array2D 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…

ParameterTypeDescription
dest *stringA1 address of the destination TOP-LEFT cell, e.g. "BU5". The copy lands in a rectangle of the same size starting here.
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
sheet *stringSource sheet name (case-sensitive).
source *stringA1 range to copy, e.g. "BT5:BT120" or a single cell "C7".
dest_sheetstring | nullDestination sheet if different from `sheet`. Formula references shift the same way; sheet-qualified refs keep pointing at their original sheets.
modestring"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 â…

ParameterTypeDescription
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
script *stringJavaScript 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),…

ParameterTypeDescription
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
sheet *string
formatobjectPartial format (only when using single-range form).
operationsarrayBulk 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…
rangestringA1 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.

ParameterTypeDescription
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
sheet *string
columnsstringSingle-op form (omit `operations`). Comma-separated column letters.
operationsarrayBulk form. Each entry sets a width on a group of columns. Use this when you need different widths for different column groups.
widthnumberSingle-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.

ParameterTypeDescription
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
sheet *string
heightnumberSingle-op form pixel height.
operationsarrayBulk form. Each entry sets a height on a group of rows.
rowsstringSingle-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".

ParameterTypeDescription
path *stringPath 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.

ParameterTypeDescription
path *stringPath 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.

ParameterTypeDescription
cell *stringA1 address, e.g. "B7".
path *stringPath 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.

ParameterTypeDescription
cell *stringA1 address, e.g. "B7".
path *stringPath 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.

ParameterTypeDescription
name *stringSheet name (must be unique in the workbook).
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
tab_colorstring | nullOptional 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!.

ParameterTypeDescription
name *string
path *stringPath 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.

ParameterTypeDescription
new_name *string
old_name *string
path *stringPath 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.

ParameterTypeDescription
path *stringPath 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.

ParameterTypeDescription
before *integer1-indexed row number to insert before.
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
sheet *string
countinteger

delete_rows

Delete `count` rows starting at row `start` (1-indexed). Content below shifts up. Permanent — the removed rows are gone.

ParameterTypeDescription
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
sheet *string
start *integer
countinteger

insert_columns

Insert `count` empty columns starting at (and shifting right from) column `before` (column letter like "C"). Existing content shifts right.

ParameterTypeDescription
before *stringColumn letter to insert before, e.g. "C".
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
sheet *string
countinteger

delete_columns

Delete `count` columns starting at column `start` (column letter like "C"). Content to the right shifts left. Permanent.

ParameterTypeDescription
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
sheet *string
start *string
countinteger

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.

ParameterTypeDescription
freeze_cols *integerNumber of left columns to freeze.
freeze_rows *integerNumber of top rows to freeze.
path *stringPath 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.

ParameterTypeDescription
path *stringPath 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.

ParameterTypeDescription
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
rows *stringComma-separated 1-indexed row numbers.
sheet *string

show_rows

Unhide one or more rows. Same `rows` format as hide_rows.

ParameterTypeDescription
path *stringPath 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").

ParameterTypeDescription
columns *stringComma-separated column letters.
path *stringPath 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.

ParameterTypeDescription
columns *string
path *stringPath 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…

ParameterTypeDescription
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
range *stringA1 range, e.g. "G45:K45", "A1:Z10", or a single cell "B7".
sheet *stringSheet 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.

ParameterTypeDescription
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
sheetstringOptional: 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…

ParameterTypeDescription
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
query *stringLabel text to find, e.g. "total revenue".
max_resultsintegerMax matches to return (default 20).
sheetstringOptional: 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…

ParameterTypeDescription
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
sheet *stringSheet name (case-sensitive).
aggregatearrayWith group_by: aggregates to compute per group (e.g. sum of Revenue). Groups are ordered by the first aggregate, descending.
columnsarrayColumns to return (letters or header texts). Default: the header-row columns, up to 40.
end_rowintegerLast data row to scan (default: the sheet's last row).
group_bystringGroup matching rows by this column's value and return one entry per value instead of rows.
header_rowinteger1-indexed header row, when auto-detection picks the wrong one.
include_formulasbooleanReturn {v, f} for formula cells instead of the bare value.
limitintegerMax rows (or groups) to return. Default 50.
order_byobjectSort matches by a column before applying `limit` (numbers before text, blanks last).
start_rowintegerFirst data row to scan (default: the row after the header).
wherearrayPredicates, 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.

ParameterTypeDescription
name *stringDefined name, e.g. "GrowthRate" or "Revenue". Must not look like a cell address.
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
ref *stringSheet-qualified target, e.g. "Model!B22" or "Assumptions!B5:B12".
sheetstringOptional. 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.

ParameterTypeDescription
path *stringPath 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.

ParameterTypeDescription
batch_id *string
path *stringPath 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.

ParameterTypeDescription
path *stringPath of the .xlsx to operate on (absolute, or ~/… for the user's home directory).
asstringOptional: write the result to this path instead (a copy), leaving the original untouched. Pending batches stay pending against the original.