# mcp-server-spreadsheet [Health: Active]

**Category:** 🏢 Workplace & Productivity  
**Repository:** https://github.com/marekrost/mcp-server-spreadsheet  
**GitHub Stars:** 2  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/mcp-server-spreadsheet

## Description
MCP server for spreadsheet files (.xlsx, .csv, .ods) - cell-level ops + DuckDB SQL engine.

## Tools
Capabilities this server exposes over MCP:

- **list_workbooks** — List all spreadsheet files (.xlsx, .csv, .ods) in a directory (non-recursive).

    Returns the full path of each file found, sorted alphabetically.
    
- **create_workbook_file** — Create a new empty spreadsheet file at the given path.

    The file format is determined by the extension (.xlsx, .csv, or .ods).
    The file must not already exist. Returns the absolute path of the
    created file.
    
- **copy_workbook** — Copy an existing spreadsheet file to a new location.

    Performs a full file copy preserving all data. The destination must
    not already exist. Returns the absolute path of the new file.
    
- **list_sheets** — List all sheet names in a workbook, in workbook order.

    Returns a list of sheet name strings. CSV files always return
    a single sheet named 'default'.
    
- **add_sheet** — Add a new sheet to the workbook.

    Returns the name of the newly created sheet. Not supported for CSV files.
    
- **rename_sheet** — Rename an existing sheet in the workbook.

    Returns the new sheet name on success.
    
- **delete_sheet** — Delete a sheet by name from the workbook.

    All data in the sheet is permanently removed. Not supported for CSV files.
    
- **copy_sheet** — Duplicate a sheet within the same workbook.

    Copies all cell values. Returns the name of the new sheet.
    Not supported for CSV files.
    
- **read_sheet** — Read an entire sheet (or a bounded sub-region) as a list of rows.

    Each row is a list of cell values. Empty cells appear as null.
    Use the optional row/column bounds to limit output for large sheets.
    
- **read_cell** — Read the value of a single cell.

    Returns the cell's value: numbers as int/float, text as string,
    and empty cells as null.
    
- **read_range** — Read a rectangular range of cells as a list of rows.

    Returns a 2D array where each inner list is one row of values.
    Empty cells return null.
    
- **get_sheet_dimensions** — Get the dimensions of the used range in a sheet.

    Returns {"rows": N, "columns": M} where N is the number of the last
    used row and M is the number of the last used column. Both are 0 for
    an empty sheet.
    
- **write_cell** — Write a single value to a cell.

    Overwrites any existing value. The value is type-coerced: numeric
    strings become numbers, all else is text.
    
- **write_range** — Write a 2D array of values into a rectangular region.

    Writing starts at start_cell and expands right and down to fit the
    data. Prefer this over multiple write_cell calls for efficiency.
    
- **append_rows** — Append one or more rows after the last used row in the sheet.

    Values are type-coerced (numeric strings to numbers).
    This is the most efficient way to add data to the end of a sheet.
    
- **insert_rows** — Insert rows at a given position, shifting existing rows down.

    If data is provided, the inserted rows are filled with those values
    (type-coerced). Otherwise the rows are left blank.
    
- **delete_rows** — Delete one or more rows, shifting remaining rows up.

    All data in the deleted rows is permanently removed.
    
- **clear_range** — Clear all cell values in a range without removing rows or columns.

    Sets every cell in the range to null. Row/column structure is preserved.
    
- **copy_range** — Copy a rectangular block of cells to another location.

    Copies raw values only. The destination can be on the same sheet or
    a different sheet in the same workbook. Existing values at the
    destination are overwritten.
    
- **insert_columns** — Insert one or more blank columns, shifting existing columns right.
- **delete_columns** — Delete one or more columns, shifting remaining columns left.
- **search_sheet** — Search all cells in a sheet for values matching a regex pattern.

    Returns a list of matches, each with the cell reference and value,
    e.g. [{"cell": "B3", "value": "hello"}, ...]. Returns an empty list
    if no matches are found.
    
- **describe_table** — Inspect the structure of a sheet treated as a database table.

    Returns column names, inferred data types (text, integer, number,
    boolean, date), total row count, and sample values from the first 3
    data rows. Use this before writing SQL queries to understand the
    available columns and their types.

    When sheet is omitted, returns a list of descriptions for all sheets.
    
- **sql_query** — Execute a read-only SQL SELECT query against the spreadsheet data.

    Every sheet in the workbook is loaded as a database table, with the
    header row defining column names and data rows below it. Returns
    results as a list of {column: value} objects.

    Only SELECT (and WITH ... SELECT) statements are accepted. Use
    sql_execute for INSERT, UPDATE, or DELETE.
    
- **sql_execute** — Execute a mutating SQL statement and write changes back to the file.

    Supports INSERT INTO (adds rows), UPDATE (modifies cell values), and
    DELETE FROM (removes rows). The target sheet is determined from the
    SQL statement. After execution, the modified table is written back to
    the file atomically. Returns {"affected_rows": N}.
    

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "mcp-server-spreadsheet": {
    "command": "uvx",
    "args": ["mcp-server-spreadsheet"],
    "env": {
      "MCP_SPREADSHEET_ROOT": ""
    }
  }
}
```

**Requires environment variables:** `MCP_SPREADSHEET_ROOT` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What mcp-server-spreadsheet MCP server does

The mcp-server-spreadsheet MCP server gives agents data-only access to Excel workbooks, CSV files, and OpenDocument spreadsheets. It can inspect workbook structure, read values, change cells and ranges, manage rows and columns, search sheet contents, and create or copy files. Existing formatting is preserved, but the server reads and writes values rather than formatting properties.

CSV files are represented as single-sheet workbooks using the sheet name `default`. Excel and ODS files can contain multiple sheets. The supported formats differ in formula handling: formulas remain as strings in `.xlsx`, are not preserved in `.ods`, and do not apply to CSV. Values loaded from CSV are inferred as integers, floating-point numbers, or text.

## How it works

Operations are stateless. Every sheet-level call includes a `file` path and may include a `sheet`; when omitted, the first sheet is used. Row and column positions are one-based, and cells use A1 references such as `B3` or `$B$2`.

The server offers two modes that can be mixed against the same file. Direct workbook tools handle individual cells, rectangular ranges, rows, columns, sheets, and searches. The SQL mode loads sheet data into an in-memory DuckDB database. Read-only `SELECT` statements support joins between sheets, grouping, aggregates, subqueries, filtering, sorting, and limits. `INSERT`, `UPDATE`, and `DELETE` statements write their changes back to the spreadsheet.

SQL calls accept optional `header_row` and `data_start_row` values. These can be a single row number for all sheets or mappings for different sheets, which supports workbooks with title rows, units rows, or headers below the first row.

## Setup and configuration

Python 3.10 or newer is required. The recommended installation runs the published package with `uvx`:

```json
{
  "mcpServers": {
    "mcp-server-spreadsheet": {
      "command": "uvx",
      "args": ["mcp-server-spreadsheet"]
    }
  }
}
```

The same stdio configuration is documented for Claude Desktop and Claude Code. A source checkout can be run with `uv sync`, followed by `uv run main.py`, or configured through `uv run --directory ... main.py`.

Set `MCP_SPREADSHEET_ROOT` to restrict file arguments to one directory tree. If it is unset, any path accessible to the server process may be used. Writes are saved atomically by writing a temporary file and replacing the target.

## Tools and capabilities

The mcp-server-spreadsheet MCP server includes tools for:

- Listing, creating, and copying workbook files.
- Listing, adding, renaming, deleting, and copying sheets.
- Reading complete sheets, ranges, cells, and used-range dimensions.
- Writing cells or 2D ranges, appending or inserting rows, deleting rows, and clearing ranges.
- Inserting or deleting columns and copying ranges, including between sheets.
- Searching for literal values or regular-expression matches.
- Describing SQL table columns, inferred types, row counts, and sample values.
- Running read-only queries or SQL mutations through DuckDB.

Sheet creation, deletion, and copying are not available for CSV files because CSV is modeled as one sheet.

## Limitations and notes

The server does not provide formatting operations. Formula behavior depends on the file format, and SQL table names based on sheet names containing spaces must be quoted. SQL mutations preserve rows above a configured `header_row`, while direct edits operate on the specified cell or range. File access is controlled by the operating system unless `MCP_SPREADSHEET_ROOT` is configured.

_Full upstream README: https://allmcps.com/mcp/mcp-server-spreadsheet/readme_

