Skip to main content
Glama

sheet-mcp

Let your AI agent read and edit Excel files without wrecking them.

sheet-mcp is an MCP server for .xlsx workbooks. Its edge over the other Excel MCP servers (for example haris-musa/excel-mcp-server, mort-lab/excel-mcp, bassem-elsodany/mcp_excel_server) is what it refuses to do:

  • It checks the file's zip structure before editing and lists everything a save would destroy: charts, images, shapes, pivot tables, macros, slicers, external links, threaded comments, dynamic-array formulas, sparklines, x14 conditional formats and more. If any are present, every edit is refused unless you pass allow_loss=true.

  • Edits are dry runs by default (a before/after table), and they write a new file (report.edited.xlsx). Nothing is overwritten unless you say overwrite=true, and the write is atomic (temp file, then replace).

  • Formulas stay formulas. Untouched cells, number formats, styles, column widths, data validation, conditional formatting, defined names, tables, comments and merged cells come out of an edit identical (the test suite proves it cell by cell).

  • It never pretends to calculate. Values are the results Excel cached in the file; if the file was never calculated (written by a script) the tools say so instead of showing blanks.

Install

Claude Code:

claude mcp add sheet -- uvx sheet-mcp --dir "/path/to/your/spreadsheets"

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "sheet": {
      "command": "uvx",
      "args": ["sheet-mcp", "--dir", "C:\\Users\\you\\Documents\\spreadsheets"]
    }
  }
}

--dir is the only place the server may read or write (default: the directory it was started in). Paths you give the tools are relative to it. Windows paths work.

Related MCP server: xlsx-for-ai

Tools

Tool

What it does

workbook_overview

Sheets (hidden / very hidden), used ranges, tables, named ranges, merged cells, hidden rows/columns, validations, conditional formats, comments, formula counts, formulas with no cached value, error cells, date system, and what a save would lose

read_range

Cells as markdown / csv / json. mode: values, formulas or both. Dates as ISO 8601 with the number format noted, merged ranges listed, capped with "continue with range X"

find_cells

Text, regex or number search across sheets, in values, formulas or both. Turkish-aware case folding (istanbul finds İstanbul)

describe_columns

Header detection, inferred type per column, nulls, distinct, min/max, mixed types, numbers stored as text, formulas vs constants

check_formulas

Broken refs, unknown names, error cells, circular refs, R1C1 pattern outliers, typed numbers inside a column of formulas, hardcoded numbers in formulas, volatile functions

set_cells

Write cells (value or formula) with explicit coercion rules. Dry run first. Refuses merged interiors and array formulas

append_rows

Append after the last data row or to an Excel table, copying styles and number formats from the row above

add_sheet / rename_sheet

Validated names. Rename rewrites every real reference (formulas on all sheets, names, validations, conditional formats, hyperlinks) and never touches text inside strings

csv_to_xlsx / xlsx_to_csv

Explicit encoding (utf-8, utf-8-sig, cp1254, ...) and delimiter (comma, semicolon, tab, pipe). A wrong encoding is an error, not garbage

How set_cells interprets values

You send

Stored as

"=SUM(A1:A3)"

a formula

"'=not a formula"

the text =not a formula (one leading apostrophe is removed)

"'007"

the text 007

42, 3.5

numbers; true / false are booleans; null clears the cell

"2024-12-31", "2024-12-31T10:30"

real dates (the cell keeps its date format, or gets yyyy-mm-dd)

any other string

text. Strings are never silently turned into numbers

Also checked: unbalanced parentheses, formulas pointing at sheets that do not exist, control characters, cells beyond XFD1048576. Newer functions that Excel stores as _xlfn.NAME (XLOOKUP, IFS, TEXTJOIN ...) and dynamic-array functions (FILTER, SORT, UNIQUE ...) produce a warning, because openpyxl cannot write them the way Excel expects.

What a save does and does not preserve

openpyxl (the library underneath) cannot calculate and cannot round-trip everything:

  • Always (every save): cached formula results are dropped. The formulas are kept, and Excel recalculates when the file is opened. Until then, other readers (pandas, previewers) see empty formula cells. The tool tells you this after each save.

  • Refused unless allow_loss=true: charts, images, shapes and text boxes, pivot tables, macros (VBA), slicers and timelines, external links, threaded comments, form controls / ActiveX, embedded objects, data connections / Power Query, the data model, dynamic-array metadata, custom ribbon UI, sparklines, x14 conditional formatting and data validation.

  • Harmless, reported: the calculation chain, printer settings, and comment box sizes (text and authors are kept).

After writing, the server re-opens the new file and checks that every sheet has exactly the number of formulas it should; if not, nothing is written to the destination.

Try asking

  • "Give me an overview of budget.xlsx. Is it safe to edit?"

  • "Show me Sheet1!A1:F30 with formulas and values side by side."

  • "Which cells in forecast.xlsx use VLOOKUP? Do any formulas look inconsistent with their neighbours?"

  • "Describe the columns of the Customers sheet. Is any column a mix of formulas and typed numbers?"

  • "Set C7 to =SUM(C2:C6) and D7 to the date 2026-01-31. Show me the dry run first."

  • "Append these three rows to the Orders table."

  • "Rename the sheet Q1 to Q1 2026 and tell me which formulas change."

  • "Convert export.csv (Windows-1254, semicolon separated) to xlsx."

Security

  • Sandbox: every path is resolved and must stay inside --dir; .. and absolute paths elsewhere are refused (symlinks are resolved first).

  • Zip bombs: at most 10,000 entries, 512 MiB per entry, 1 GiB in total, a 500:1 compression ratio limit, entry sizes verified while reading (a header that lies is refused), duplicate or path-traversing entry names refused, files over 256 MiB refused. Editing additionally needs the sheet XML to be at most 100 MiB (it is loaded into memory); reading has no such limit.

  • XML attacks: any XML part containing a DOCTYPE or ENTITY declaration is refused before parsing (Excel never writes one), non-UTF-8 XML is refused, and parsing goes through defusedxml. A billion-laughs workbook is part of the test suite.

  • Regex search: patterns over 200 characters or with nested quantifiers like (a+)+ are refused; Python's re has no timeout, so this is a guard rather than a guarantee.

  • CSV: fields starting with = are imported as text, never as formulas. Exports are written as-is, so treat a CSV exported from untrusted data as untrusted when opening it in Excel.

  • Writes: never in place by default, never over an existing file without overwrite=true, atomic replace, and temp files are cleaned up on failure.

  • Macros are never executed (nothing here runs workbook code).

Limits

  • Formulas are not calculated. There is no recalculation engine; read cached results or open the file in Excel / LibreOffice.

  • .xls (old binary) and password-protected workbooks are refused with an explanation.

  • .xlsm can be edited only with allow_loss=true (the VBA project bytes are carried over; buttons and ribbon wiring may not be).

  • Circular-reference detection follows direct cell and range references only (not INDIRECT, OFFSET, names or table references). Column-pattern checks flag only a cell that differs from the formulas directly above and below it.

  • CSV/TSV are handled through the two conversion tools; the read tools take .xlsx/.xlsm.

Development

uv sync --extra test
uv run pytest tests
uv run --with ruff==0.16.0 ruff check src tests
uv run --with mypy==2.3.0 mypy --strict src

Tests run against real workbooks: files written by openpyxl, hand-zipped XML for features openpyxl never writes (chart parts, pivot caches, vbaProject.bin, external links ...), a billion-laughs and a real compression-ratio zip bomb, 1900 and 1904 date systems, Turkish text, a 200,000-row sheet, and a test that launches the installed server over real MCP stdio.

There is a from-scratch tutorial that builds a minimal version of this server step by step: sheet-mcp-the-hard-way.

MIT licensed.

Available Tools

11 tools
add_sheetB

Add an empty sheet. name is validated (max 31 characters, none of [ ] : * ? / , unique ignoring case). position is 1-based (default: at the end). DRY RUN BY DEFAULT; output/overwrite/ allow_loss work as in set_cells.

Inputs: name (required), path (required), output, dry_run, +3 more. Returns: result

append_rowsA

Append rows after the last data row (or to the bottom of an Excel table). DRY RUN BY DEFAULT.

rows: list of rows, each a list of values using the same coercion rules as set_cells ('=...' formula, leading quote = literal text, ISO dates, null = empty cell). table: name of an Excel table on the sheet to extend (its range grows with the new rows). If the last data row belongs to a table and table= is omitted, the call is refused so rows are not left outside the table. Tables with a totals row are refused. Number formats and styles are copied from the row above. Rows start in the first used column. Refused if the space below is not empty. Warns when data validation or conditional formatting ranges end at the old last row and will not cover the new rows. output/overwrite/allow_loss work as in set_cells.

Inputs: path (required), rows (required), sheet (required), table, +4 more. Returns: result

check_formulasA

Audit formulas structurally (nothing is calculated). Reports: broken references (#REF! or a missing sheet), unknown names (#NAME?), cells currently showing error values, circular references reachable through direct cell/range references, formulas that differ from the pattern (R1C1) of the formulas directly above AND below them in the same column, typed numbers sitting inside a column of formulas, hardcoded numbers inside arithmetic (e.g. =A2*1.18), and volatile functions (NOW, TODAY, RAND, OFFSET, INDIRECT ...). Results are grouped per kind and capped by max_issues. Use sheet= to check one sheet.

Inputs: path (required), sheet, max_issues. Returns: result

csv_to_xlsxA

Convert a CSV/TSV file into a new .xlsx.

encoding: any Python codec: utf-8, utf-8-sig (Excel's BOM), cp1254 (Turkish), cp1252, latin-1, utf-16 ... A wrong encoding is an error, never silently garbled. delimiter: one character or one of comma, semicolon, tab, pipe (Turkish/German Excel exports often use semicolons). infer_types: plain numbers (no leading zeros, at most 15 digits) and ISO dates become real numbers/dates; everything else stays text. Fields starting with '=' always stay text (a CSV is data, not formulas). Set false to store every field as text. Refuses to replace an existing output unless overwrite=true.

Inputs: output (required), csv_path (required), encoding, delimiter, +3 more. Returns: result

describe_columnsA

Profile the columns of a sheet or range like a data table: detected header row, inferred type per column (integer, number, text, date, datetime, boolean, mixed ...), non-null and empty counts, distinct count, min/max, most common text values, numbers stored as text, error cells, and whether the column holds formulas, constants or a MIX of both (a sign someone overwrote a formula with a typed number).

header_row: omit to auto-detect; 0 means 'no header'; N means row N is the header (rows above it are ignored). range limits the area (default: the whole used range).

Inputs: path (required), sheet (required), range, max_rows, +1 more. Returns: result

find_cellsA

Find cells across all sheets (or one) and return their addresses.

mode: 'text' (substring), 'regex' (Python regular expression), or 'number' (numeric cells equal to the query, e.g. '1234.5'). search_in: 'values' (cached results / constants), 'formulas' (formula text, e.g. find every cell that uses VLOOKUP), or 'both' (default). Case-insensitive search also folds Turkish letters (dotted/dotless i, and u o s c g with their Turkish marks), so 'istanbul' finds 'İstanbul' and 'urun' finds 'Ürün'. Each hit shows the sheet, address, value and formula.

Inputs: path (required), query (required), mode, sheet, +3 more. Returns: result

read_rangeA

Read cells from one sheet.

range: A1-style: 'A1:D20', 'B3', 'A:C' (whole columns), '2:9' (whole rows). Omit for the whole used range. Anything beyond the used range is clamped. mode: 'values' (cached results of formulas; constants as stored), 'formulas' (formula text instead of results), or 'both' ('=SUM(A1:A3) -> 6'). format: 'markdown' (default, with row numbers and column letters), 'csv', or 'json'. max_cells: output cap (default 2000, max 20000); when exceeded the reply says which range to request next.

Dates are shown as ISO 8601 and the number format is reported in a note. Formulas are NOT calculated: if the file has no cached values the reply says so instead of showing blanks. Merged ranges in view are listed (the value lives in the top-left cell).

Inputs: path (required), sheet (required), mode, range, +2 more. Returns: result

rename_sheetA

Rename a sheet AND update every reference to it: formulas on all sheets (only real references, never text inside string literals), defined names, data-validation and conditional-format formulas, and internal hyperlinks. DRY RUN BY DEFAULT: lists each formula that would change. new_name is validated like add_sheet. output/overwrite/allow_loss work as in set_cells.

Inputs: path (required), sheet (required), new_name (required), output, +3 more. Returns: result

set_cellsA

Write single cells, changing nothing else. DRY RUN BY DEFAULT: shows before/after for every cell and writes nothing; repeat with dry_run=false to save.

changes: list of {"cell": "B7", "value": ...} or {"cell": "B7", "formula": "SUM(B2:B6)"}, with an optional per-change "sheet". Value coercion rules:

  • a string starting with '=' is a FORMULA ("=SUM(A1:A3)")

  • a string starting with a single quote is literal TEXT with the quote removed ("'=not a formula" stores =not a formula; "'007" stores the text 007)

  • JSON numbers are numbers, true/false are booleans, null clears the cell

  • ISO strings 'YYYY-MM-DD' and 'YYYY-MM-DDTHH:MM[:SS]' become real dates (the cell keeps its date format, or gets yyyy-mm-dd); use a leading quote to keep such a string as text

  • any other string is text (never auto-converted to a number) Existing styles, number formats, validations, conditional formats and column widths are kept. Writes into merged-cell interiors and array formulas are refused. Formulas referring to a sheet that does not exist are refused.

The result goes to a NEW file '.edited.xlsx' next to the original unless output= is given; an existing file is never replaced unless overwrite=true (use overwrite=true with output equal to path to edit in place). If the workbook has features openpyxl would drop (see workbook_overview) the edit is refused unless allow_loss=true. All formulas lose their cached results on save (Excel recalculates when opened).

Inputs: path (required), sheet (required), changes (required), output, +3 more. Returns: result

workbook_overviewA

Start here. Summarise a workbook without changing it: sheets (with hidden/very hidden state), used ranges, tables, named ranges, merged cells, hidden rows/columns, data validations, conditional formats, comments, number of formulas, formulas that have NO cached value (the file was never calculated), cells showing errors like #REF!, and the list of features that saving would LOSE (charts, images, pivot tables, macros, slicers, external links, ...). The file is checked for zip bombs and XML entity attacks first.

path: .xlsx or .xlsm, relative to the server's --dir (or absolute inside it).

Inputs: path (required). Returns: result

xlsx_to_csvA

Export one sheet (or a range) to CSV/TSV (.csv, .tsv or .txt).

mode: 'values' writes cached results (formula cells with no cached value are written empty and counted in a warning); 'formulas' writes the formula text. Dates are ISO 8601. encoding/delimiter as in csv_to_xlsx; characters the encoding cannot represent are an error. Refuses to replace an existing output unless overwrite=true.

Inputs: path (required), sheet (required), output (required), mode, +4 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 11 tools

    Disambiguation5/5

    Each tool has a distinct purpose: overview, read, search, profile, audit formulas, write cells, append rows, add/rename sheet, and CSV import/export. Overlaps such as read_range vs describe_columns or find_cells vs check_formulas are clearly separated by intent (raw extraction vs profiling vs structural audit). An agent can confidently pick the right tool.

    Naming Consistency4/5

    Nine of eleven tools follow a clear verb_noun pattern (read_range, find_cells, set_cells, add_sheet, etc.). The two conversion tools use noun_to_noun (csv_to_xlsx, xlsx_to_csv) and workbook_overview is noun_noun, which are minor but readable deviations.

    Tool Count5/5

    Eleven tools is well within the ideal 3–15 range for a spreadsheet server. Each tool covers a meaningful capability, with no redundant or filler operations.

    Completeness4/5

    The surface covers reading, analysis, formula auditing, cell/row writing, sheet creation/renaming, and CSV import/export, which handles most real workflows. Minor gaps remain: no delete-sheet or delete-rows operation, and no formatting/style manipulation, though set_cells with null can clear individual cells.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      B
      maintenance
      50 tools and 400 functions for working with Excel/.xlsx spreadsheets — read/write, recalculate formulas, diff, repair broken references, and audit. Built for AI agents.
      76
      2,271 npm
      6
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to perform comprehensive Excel workbook operations with verified, freshness-labeled values and structural edits that preserve formulas, tables, and references, optionally using a private Excel instance for real recalculation and export.
      7
      1
      AGPL 3.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI coding agents to edit real .xlsx workbooks in place through spreadsheet-native tools like describe, find, read, write, and structural edits, recalculating formulas without Excel, LibreOffice, or Python. Every change comes back as a review link showing changed cells before and after, and nothing is written until the user accepts, while charts, pivots, and VBA data return byte-identical.
      11
      Apache 2.0