# xlsx-tools-mcp [Health: Active]

**Category:** 🏢 Workplace & Productivity  
**Repository:** https://github.com/ruriazz/xlsx-tools-mcp  
**GitHub Stars:** 5  
**Views:** 40  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/xlsx-tools-mcp

## Description
MCP server for accurate, structure-preserving read/write access to Excel (.xlsx) files

## Tools
Capabilities this server exposes over MCP:

- **restore_backup** — Restore a backup file over a target workbook atomically.

    Args:
        backup_path: Path to the .bak file to restore from.
        target_path: Path to the target .xlsx/.xlsm file to overwrite.
    
- **list_configured_files** — List files preloaded at server startup (via the XLSX_MCP_FILES env var).

    Call this first if unsure which files are available — every other tool's `path`
    argument accepts these names directly (or can be omitted if only one is configured),
    no filesystem search needed.
    
- **list_sheets** — List every sheet in a workbook with its approximate row/column counts.

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
    
- **get_workbook_info** — Get workbook-level metadata: sheets, exact dimensions, active sheet, defined names.

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
    
- **read_sheet** — Read cell values from a sheet.

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name.
        cell_range: Optional A1-style range (e.g. "B2:F20"). Omit to read the full used area.
        max_rows: Optional cap on the number of rows returned, to bound response size for large sheets.
        offset_row: Skip a number of data rows (0-indexed from first data row).
        format: "array" (default 2D list), "records" (list of dicts, first row as keys), or "markdown" (table string).
    
- **get_cell** — Get full detail for a single cell: value, formula, number format, font, fill, merge, comment.

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name.
        cell: Cell reference, e.g. "C5".
    
- **search_workbook** — Search cell values across one or all sheets for a substring match.

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        query: Substring to search for.
        sheet: Restrict the search to one sheet; omit to search every sheet.
        match_case: Case-sensitive match when True.
        limit: Optional cap on the number of matches returned, to bound response size for large sheets.
    
- **aggregate_sheet** — Group and aggregate sheet data with pandas (e.g. sum sales by region).

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name.
        group_by: Column names to group by (taken from the header row).
        agg: Mapping of column name to aggregation function, e.g. {"amount": "sum"}.
        cell_range: Optional A1-style range to read before aggregating.
        has_header: Whether the first row of the range holds column names.
    
- **create_workbook** — Create a new .xlsx workbook.

    Args:
        path: Path for the new file. New files aren't preloaded, so this must be a real path.
        sheets: Sheet names to create (defaults to a single "Sheet1").
        overwrite: Replace an existing file at path when True.
    
- **write_cells** — Write values and/or formulas into specific cells, then recalculate the workbook.

    Set `recalculate=False` to skip the LibreOffice recompute (e.g. for structurally
    complex workbooks you don't want round-tripped).

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name.
        cells: List of {"cell": "A1", "value": ...} or {"cell": "B1", "formula": "=A1*2"}.
        create_sheet_if_missing: Create the sheet first if it doesn't exist yet.
        recalculate: Run the LibreOffice recompute pass after saving.

    Returns:
        Write result including `errors_found` — any Excel error values produced by recalculation.
    
- **append_rows** — Append rows after the last used row of a sheet, then recalculate the workbook.

    Set `recalculate=False` to skip the LibreOffice recompute (e.g. for structurally
    complex workbooks you don't want round-tripped).

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name.
        rows: List of rows, each a list of cell values in column order.
        create_sheet_if_missing: Create the sheet first if it doesn't exist yet.
        recalculate: Run the LibreOffice recompute pass after saving.
    
- **create_sheet** — Add a new empty sheet to an existing workbook.

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Name for the new sheet.
        index: Zero-based position to insert at; omit to append at the end.
    
- **delete_sheet** — Delete a sheet from a workbook. Fails if it is the only sheet left.

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name to delete.
    
- **insert_rows** — Insert blank rows, shifting existing rows down.

    Set `recalculate=False` to skip the LibreOffice recompute (e.g. for structurally
    complex workbooks you don't want round-tripped).

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name.
        start_row: 1-based row index to insert before.
        count: Number of rows to insert.
        recalculate: Run the LibreOffice recompute pass after saving.
    
- **delete_rows** — Delete rows, shifting the rows below them upward.

    Set `recalculate=False` to skip the LibreOffice recompute (e.g. for structurally
    complex workbooks you don't want round-tripped).

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name.
        start_row: 1-based row index to start deleting from.
        count: Number of rows to delete.
        recalculate: Run the LibreOffice recompute pass after saving.
    
- **insert_columns** — Insert blank columns, shifting existing columns right.

    Set `recalculate=False` to skip the LibreOffice recompute (e.g. for structurally
    complex workbooks you don't want round-tripped).

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name.
        start_column: 1-based column index to insert before.
        count: Number of columns to insert.
        recalculate: Run the LibreOffice recompute pass after saving.
    
- **delete_columns** — Delete columns, shifting the columns to their right leftward.

    Set `recalculate=False` to skip the LibreOffice recompute (e.g. for structurally
    complex workbooks you don't want round-tripped).

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name.
        start_column: 1-based column index to start deleting from.
        count: Number of columns to delete.
        recalculate: Run the LibreOffice recompute pass after saving.
    
- **merge_cells** — Merge a rectangular range of cells into one.

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name.
        cell_range: A1-style range, e.g. "A1:C1".
    
- **unmerge_cells** — Undo a merge on a range of cells.

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name.
        cell_range: A1-style range that was previously merged.
    
- **set_cell_style** — Apply formatting to a range of cells.

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name.
        cell_range: A1-style range, e.g. "A1:D1".
        style: Keys among: bold, italic, font_size, font_color (hex RGB, e.g. "FF0000"),
            bg_color (hex RGB), horizontal, vertical (alignment), border ("thin", "medium",
            "thick", ...), number_format (e.g. "#,##0.00").
    
- **rename_sheet** — Rename an existing sheet.

    Warning: This tool does NOT automatically update formula references in other sheets.
    Formulas depending on the old sheet name will break.

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        old_name: Current name of the sheet.
        new_name: New name for the sheet (1-31 chars, valid Excel sheet name).
    
- **copy_sheet** — Duplicate a sheet including its contents, formulas, and styles.

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        source_sheet: Name of the sheet to duplicate.
        target_sheet: Name of the new sheet (1-31 chars, valid Excel sheet name).
    
- **autofit_columns** — Automatically adjust column widths based on maximum text length.

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name.
        min_width: Minimum allowed column width.
        max_width: Maximum allowed column width.
        padding: Extra padding characters to add to max length.
    
- **clear_range** — Clear cell values and/or styles within a specified range without deleting rows or columns.

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name.
        cell_range: A1-style range (e.g. "A1:D10") to clear.
        clear_values: Whether to clear cell values (True by default).
        clear_styles: Whether to clear cell styles/formats (False by default).
    
- **recalculate_workbook** — Force a LibreOffice headless recalculation pass and report any formula errors found.

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
    
- **profile_sheet** — Profile sheet data: metadata, inferred types, null counts, min/max, sample values.

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name.
        sample_rows: Number of non-null sample values to return per column.
    
- **query_sheet** — Query sheet data using pandas expressions without returning the entire sheet into the LLM context.

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name.
        filter_query: Pandas query expression (e.g. "status == 'PAID' and amount > 500").
        columns: Optional list of columns to return.
        max_rows: Maximum rows to return (default 100).
        cell_range: Optional range to restrict reading before querying.
    
- **create_table** — Create a formal Excel Table (ListObject) on the specified range.

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name.
        cell_range: A1-style range (e.g. "A1:D10").
        table_name: Unique table identifier across the workbook.
        style_name: Table style name (e.g. "TableStyleMedium9").
        show_filter: Whether to display auto-filter dropdown arrows.
        show_row_stripes: Whether to apply alternating row shading.
        backup: Whether to create a backup before modifying the workbook.
    
- **create_chart** — Create a native Excel chart (bar, line, pie, scatter).

    Args:
        path: Path to the .xlsx file, or the name of a preloaded file. Omit if only
            one file is configured.
        sheet: Sheet name.
        chart_type: One of "bar", "line", "pie", "scatter".
        data_range: A1-style range holding the chart series values (e.g. "B1:B10").
        categories_range: Optional A1-style range holding series category labels (e.g. "A2:A10").
        title: Title string displayed on the chart.
        target_cell: Cell coordinate where the top-left corner of the chart is placed.
        backup: Whether to create a backup before modifying the workbook.
    

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

```json
"mcpServers": {
  "xlsx-tools-mcp": {
    "command": "uvx",
    "args": ["xlsx-tools-mcp"]
  }
}
```

## Documentation

## What xlsx-tools-mcp MCP server does

The xlsx-tools-mcp MCP server connects MCP clients to local Excel `.xlsx` files. Its 29 tools cover workbook inspection, cell and range reads, value searches, data aggregation, querying, cell and formula writes, sheet management, row and column operations, formatting, tables, charts, and formula recalculation.

Edits are designed to leave untouched workbook content in place. The write path uses openpyxl to load and save the existing file, which can preserve styles, merged cells, comments, formulas, and other content outside the requested change. Automatic per-file locking serializes concurrent operations so calls do not interleave on the same workbook.

## How it works

Read operations primarily use python-calamine, a Rust-backed parser that provides fast type inference. The server falls back to openpyxl when a request needs formulas, styles, comments, or when calamine cannot parse the file. Aggregation and querying use pandas, with AST validation for expressions supplied to those operations.

Value and formula writes can invoke LibreOffice in headless mode after saving. LibreOffice recalculates formulas, and the server scans the resulting workbook for Excel errors such as `#REF!`, `#DIV/0!`, and `#N/A`. Without LibreOffice, writes still complete through openpyxl, but formulas are not recomputed and a warning is returned.

The xlsx-tools-mcp MCP server also supports path confinement through an allowed-directory setting, automatic backup files before writes, and atomic backup restoration. Formula-writing tools reject selected external or potentially unsafe formulas by default, including formulas using `WEBSERVICE`, `HYPERLINK`, `INDIRECT`, `RTD`, `CALL`, or `REGISTER`.

## Setup and configuration

Python 3.10 or newer is required. Install the published package with `pip install xlsx-tools-mcp`, run it with `xlsx-tools-mcp`, or use `uvx xlsx-tools-mcp` without cloning the repository. Source installation is also available through `git clone`, `uv sync`, and `uv run xlsx-tools-mcp`.

The server uses standard stdio transport and is registered with an MCP client rather than normally run as a standalone interactive process. Claude Code can add it with `claude mcp add xlsx-tools-mcp -- uvx xlsx-tools-mcp`. OpenCode configuration can use the same `uvx` command.

LibreOffice is optional and recommended when formula results must be current. The server searches for `soffice` or `libreoffice` on `PATH`, along with standard macOS and Windows installation paths. `XLSX_MCP_ALLOWED_DIRS` restricts file access, `XLSX_MCP_AUTO_BACKUP` controls the default backup behavior, and `XLSX_MCP_FILES` preloads workbooks that can then be referenced by alias or without a full path. Values for directory and file lists accept commas or semicolons.

## Tools and capabilities

- List sheets and inspect cell ranges.
- Search workbook values and query or aggregate sheet data.
- Write values and formulas, append rows, and insert or delete rows and columns.
- Rename, copy, or clear sheets and ranges; auto-fit columns and apply styles.
- Create native Excel tables with autofilters and styles.
- Create bar, line, pie, and scatter charts.
- Recalculate formulas and report generated Excel error values.

## Limitations and notes

The xlsx-tools-mcp MCP server is intended for `.xlsx` files. LibreOffice recalculation re-exports the workbook, so it is not a bit-perfect preservation step; pivot tables, charts, data validation, some formats, and some defined names may change. For complex workbooks where that risk matters, value and formula write tools support `recalculate=False` to save with openpyxl only.

Formula recalculation is not available without LibreOffice. External-formula blocking can be bypassed with `allow_external_formulas=True`, so callers should use that option only when those formulas are acceptable. Path confinement applies when its environment variable is configured; otherwise the server does not impose that directory boundary.

_Full upstream README: https://allmcps.com/mcp/xlsx-tools-mcp/readme_

