xlsx-tools-mcp
v0.4.0MCP server for accurate, structure-preserving read/write access to Excel (.xlsx) files
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_configured_files List preloaded files
List workbooks preloaded at startup (XLSX_MCP_FILES) as name -> absolute path. Call this first when unsure which file to use: any tool's `path` accepts these names.
list_sheets List sheets
List every sheet with its approximate row and column count. Fast. For exact dimensions, hidden state and defined names use get_workbook_info.
| Parameter | Type | Description |
|---|---|---|
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. |
get_workbook_info Get workbook info
Get workbook metadata: exact dimensions and visibility of each sheet, active sheet, defined names. Slower than list_sheets on large files.
| Parameter | Type | Description |
|---|---|---|
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. |
read_sheet Read sheet values
Return the raw cell values of a sheet or range. Formula cells give their last computed result. Best for small sheets or a known range. On large sheets, filter with query_sheet, summarize with aggregate_sheet, or inspect columns with profile_sheet instead. For a cell's formula text or style use get_cell.
| Parameter | Type | Description |
|---|---|---|
sheet * | string | Sheet name (case-sensitive). |
cell_range | Range to read, e.g. "A1:F500". Omit for the whole sheet. | |
format | string | "array": 2D list. "records": list of objects keyed by the first row. "markdown": table text. |
max_rows | Return at most this many rows. Omit for no limit. | |
offset_row | integer | Skip this many rows first (after the header row for records/markdown); use with max_rows to page. |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. |
get_cell Get cell details
Get everything about one cell: computed value, formula text, number format, font, fill, merge state, comment.
| Parameter | Type | Description |
|---|---|---|
cell * | string | Cell address, e.g. "C5". |
sheet * | string | Sheet name (case-sensitive). |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. |
search_workbook Search workbook
Find the cells whose value contains some text. Returns {sheet, cell, value} per match. Use to locate data when you don't know its address; to filter table rows by conditions use query_sheet.
| Parameter | Type | Description |
|---|---|---|
query * | string | Text to look for inside cell values (substring match). |
limit | Return at most this many matches. Omit for no limit. | |
match_case | boolean | Match upper/lower case exactly. |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
sheet | Search only this sheet. Omit to search all sheets. |
profile_sheet Profile sheet columns
Summarize each column of a table-shaped sheet (first row = headers): type, empty count, min/max, sample values. Use first on an unfamiliar sheet to learn its column names before query_sheet or aggregate_sheet. Returns no cell data beyond the samples.
| Parameter | Type | Description |
|---|---|---|
sheet * | string | Sheet name (case-sensitive). |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
sample_rows | integer | Example values to show per column. |
query_sheet Query sheet rows
Return only the rows of a table-shaped sheet (first row = headers) that match a condition. Returns {columns, records, row_count, limited}; row_count counts all matches. Use instead of read_sheet when you need a subset of a large table. For totals per group use aggregate_sheet.
| Parameter | Type | Description |
|---|---|---|
filter_query * | string | Condition on header names, e.g. "Status == 'PAID' and Amount > 500". Allowed: comparisons, and/or/not, in, arithmetic. Header names must be valid identifiers (no spaces). |
sheet * | string | Sheet name (case-sensitive). |
cell_range | Range to read, e.g. "A1:F500". Omit for the whole sheet. | |
columns | Only return these columns. Omit for all. | |
max_rows | integer | Return at most this many matching rows. |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. |
aggregate_sheet Aggregate sheet
Group rows and compute totals per group (e.g. sum of Amount by Region). Returns one record per group. Use for summaries of a table; to list individual matching rows use query_sheet.
| Parameter | Type | Description |
|---|---|---|
agg * | object | Header name -> function: sum, mean, min, max, count, median, nunique, first or last. E.g. {"Amount": "sum"}. |
group_by * | array | Header names to group by, e.g. ["Region"]. |
sheet * | string | Sheet name (case-sensitive). |
cell_range | Range to read, e.g. "A1:F500". Omit for the whole sheet. | |
has_header | boolean | First row holds column names. When false, columns are named col_0, col_1, ... |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. |
create_workbook Create workbook
Create a new, empty workbook file.
| Parameter | Type | Description |
|---|---|---|
path * | string | File path for the new .xlsx or .xlsm file (preloaded names do not apply). |
overwrite | boolean | Replace an existing file at path. Refused by default. |
sheets | Sheet names to create. Default: ["Sheet1"]. |
write_cells Write cells
Set values or formulas in cells at given addresses, overwriting what is there. To add new records below existing data without computing addresses use append_rows; to make room between rows use insert_rows.
| Parameter | Type | Description |
|---|---|---|
cells * | array | Cells to set: [{"cell": "A1", "value": 100}, {"cell": "B1", "formula": "=A1*2"}]. Existing content is overwritten. |
sheet * | string | Sheet name (case-sensitive). |
allow_external_formulas | boolean | Allow WEBSERVICE, HYPERLINK, INDIRECT, RTD, CALL, REGISTER and DDE ('|') in formulas. |
backup | Save a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true). | |
create_sheet_if_missing | boolean | Create the sheet if missing. |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
reason | Why; kept in the change log (XLSX_MCP_CHANGE_LOG=true). | |
recalculate | boolean | Recompute formulas with LibreOffice after saving. False: faster, formula results stay empty. |
append_rows Append rows
Add rows below the last used row of a sheet. Never overwrites existing cells. To change existing cells use write_cells.
| Parameter | Type | Description |
|---|---|---|
rows * | array | Rows to add, each a list of values from column A, e.g. [["INV-3", 7, "=B5*2"]]. Strings starting with "=" become formulas. |
sheet * | string | Sheet name (case-sensitive). |
allow_external_formulas | boolean | Allow WEBSERVICE, HYPERLINK, INDIRECT, RTD, CALL, REGISTER and DDE ('|') in formulas. |
backup | Save a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true). | |
create_sheet_if_missing | boolean | Create the sheet if missing. |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
reason | Why; kept in the change log (XLSX_MCP_CHANGE_LOG=true). | |
recalculate | boolean | Recompute formulas with LibreOffice after saving. False: faster, formula results stay empty. |
clear_range Clear range
Empty the cells in a range (values and/or formatting). Rows and columns stay in place. To remove rows or columns and shift the rest, use delete_rows or delete_columns.
| Parameter | Type | Description |
|---|---|---|
cell_range * | string | A1-style range, e.g. "A1:D10". |
sheet * | string | Sheet name (case-sensitive). |
backup | Save a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true). | |
clear_styles | boolean | Reset formatting to the Normal style. |
clear_values | boolean | Remove values and formulas. |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
reason | Why; kept in the change log (XLSX_MCP_CHANGE_LOG=true). |
recalculate_workbook Recalculate workbook
Recompute every formula with LibreOffice and report formula errors. Writes already do this. Needed only after writes with recalculate=false or after the file was edited outside this server.
| Parameter | Type | Description |
|---|---|---|
mode | "inject": write only computed values, keep every other part. "roundtrip": replace the file with LibreOffice's export (may drop pivots, charts, validation). Default: XLSX_MCP_RECALC_MODE (inject). | |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. |
restore_backup Restore backup
Replace a workbook with one of its .bak backups, atomically.
| Parameter | Type | Description |
|---|---|---|
backup_path * | string | The .bak file to restore from (created by writes with backup enabled). |
target_path * | string | The .xlsx/.xlsm workbook to overwrite. |
create_sheet Create sheet
Add a new empty sheet. To duplicate an existing sheet use copy_sheet.
| Parameter | Type | Description |
|---|---|---|
sheet * | string | Name for the new sheet; must not exist yet. |
backup | Save a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true). | |
index | Zero-based position. Omit to add at the end. | |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
reason | Why; kept in the change log (XLSX_MCP_CHANGE_LOG=true). |
copy_sheet Copy sheet
Duplicate a sheet with its values, formulas and styles, inside the same workbook.
| Parameter | Type | Description |
|---|---|---|
source_sheet * | string | Sheet to duplicate. |
target_sheet * | string | Name for the copy (1-31 chars, must not exist yet). |
backup | Save a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true). | |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
reason | Why; kept in the change log (XLSX_MCP_CHANGE_LOG=true). |
rename_sheet Rename sheet
Rename a sheet. Formulas in other sheets that use the old name are NOT updated and will break.
| Parameter | Type | Description |
|---|---|---|
new_name * | string | New sheet name (1-31 chars, none of \ / ? * : [ ]). |
old_name * | string | Current sheet name. |
backup | Save a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true). | |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
reason | Why; kept in the change log (XLSX_MCP_CHANGE_LOG=true). |
delete_sheet Delete sheet
Delete a sheet and everything on it. Refused when it is the only sheet.
| Parameter | Type | Description |
|---|---|---|
sheet * | string | Sheet to delete. |
backup | Save a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true). | |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
reason | Why; kept in the change log (XLSX_MCP_CHANGE_LOG=true). |
insert_rows Insert rows
Insert blank rows before start_row; rows below move down.
| Parameter | Type | Description |
|---|---|---|
sheet * | string | Sheet name (case-sensitive). |
start_row * | integer | 1-based row number. |
backup | Save a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true). | |
count | integer | How many to insert or delete. |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
reason | Why; kept in the change log (XLSX_MCP_CHANGE_LOG=true). | |
recalculate | boolean | Recompute formulas with LibreOffice after saving. False: faster, formula results stay empty. |
delete_rows Delete rows
Delete rows starting at start_row; rows below move up. To empty cells without shifting use clear_range.
| Parameter | Type | Description |
|---|---|---|
sheet * | string | Sheet name (case-sensitive). |
start_row * | integer | 1-based row number. |
backup | Save a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true). | |
count | integer | How many to insert or delete. |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
reason | Why; kept in the change log (XLSX_MCP_CHANGE_LOG=true). | |
recalculate | boolean | Recompute formulas with LibreOffice after saving. False: faster, formula results stay empty. |
insert_columns Insert columns
Insert blank columns before start_column; columns to the right move right.
| Parameter | Type | Description |
|---|---|---|
sheet * | string | Sheet name (case-sensitive). |
start_column * | integer | 1-based column number (A=1, B=2, ...). |
backup | Save a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true). | |
count | integer | How many to insert or delete. |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
reason | Why; kept in the change log (XLSX_MCP_CHANGE_LOG=true). | |
recalculate | boolean | Recompute formulas with LibreOffice after saving. False: faster, formula results stay empty. |
delete_columns Delete columns
Delete columns starting at start_column; columns to the right move left. To empty cells without shifting use clear_range.
| Parameter | Type | Description |
|---|---|---|
sheet * | string | Sheet name (case-sensitive). |
start_column * | integer | 1-based column number (A=1, B=2, ...). |
backup | Save a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true). | |
count | integer | How many to insert or delete. |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
reason | Why; kept in the change log (XLSX_MCP_CHANGE_LOG=true). | |
recalculate | boolean | Recompute formulas with LibreOffice after saving. False: faster, formula results stay empty. |
merge_cells Merge cells
Merge a rectangular range into one cell. Only the top-left value is kept.
| Parameter | Type | Description |
|---|---|---|
cell_range * | string | A1-style range, e.g. "A1:D10". |
sheet * | string | Sheet name (case-sensitive). |
backup | Save a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true). | |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
reason | Why; kept in the change log (XLSX_MCP_CHANGE_LOG=true). |
unmerge_cells Unmerge cells
Split a merged range back into separate cells.
| Parameter | Type | Description |
|---|---|---|
cell_range * | string | The merged range exactly as merged, e.g. "A1:C1". |
sheet * | string | Sheet name (case-sensitive). |
backup | Save a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true). | |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
reason | Why; kept in the change log (XLSX_MCP_CHANGE_LOG=true). |
set_cell_style Set cell style
Apply font, fill, alignment, border or number format to every cell in a range. Values are not changed.
| Parameter | Type | Description |
|---|---|---|
cell_range * | string | A1-style range, e.g. "A1:D10". |
sheet * | string | Sheet name (case-sensitive). |
style * | object | Any of: bold, italic (bool); font_size (number); font_color, bg_color (hex RGB, e.g. "FF0000"); horizontal, vertical (alignment, e.g. "center"); border ("thin", "medium", "thick", ...); number_format… |
backup | Save a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true). | |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
reason | Why; kept in the change log (XLSX_MCP_CHANGE_LOG=true). |
autofit_columns Autofit columns
Set each column's width to fit its longest value, within min_width..max_width.
| Parameter | Type | Description |
|---|---|---|
sheet * | string | Sheet name (case-sensitive). |
backup | Save a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true). | |
max_width | integer | Widest width, in characters. |
min_width | integer | Narrowest width, in characters. |
padding | integer | Characters added to the longest value. |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
reason | Why; kept in the change log (XLSX_MCP_CHANGE_LOG=true). |
create_table Create table
Turn a range into a formatted Excel Table (ListObject) with optional filter buttons.
| Parameter | Type | Description |
|---|---|---|
cell_range * | string | Range including the header row, e.g. "A1:D10". Headers must be non-empty and unique. |
sheet * | string | Sheet name (case-sensitive). |
table_name * | string | Workbook-unique name: letters, digits, _ or ., starting with a letter or _. |
backup | Save a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true). | |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
reason | Why; kept in the change log (XLSX_MCP_CHANGE_LOG=true). | |
show_filter | boolean | Show filter buttons in the header row. |
show_row_stripes | boolean | Shade alternate rows. |
style_name | string | Excel table style, e.g. "TableStyleMedium9". |
create_chart Create chart
Add a native Excel chart built from ranges on the same sheet.
| Parameter | Type | Description |
|---|---|---|
chart_type * | string | Chart kind: "bar", "line", "pie" or "scatter". |
data_range * | string | Series values with the series name in the first row, e.g. "B1:B10". |
sheet * | string | Sheet name (case-sensitive). |
backup | Save a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true). | |
categories_range | Category labels, e.g. "A2:A10". | |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
reason | Why; kept in the change log (XLSX_MCP_CHANGE_LOG=true). | |
target_cell | string | Cell where the chart's top-left corner is placed. |
title | string | Chart title. |
set_rules Set rules
Replace the workbook's rules and check them once; later value-changing writes are checked automatically. A write that makes a passing rule fail (or a failing one worse) is rolled back; rules already failing never block. Stored as "<file>.rules.json". Each rule has an "id" plus one of: {"type": "cells_equal", "left": "S!B40", "right": "S!C40", "tolerance": 0.01} {"type": "cell_compare", "cell": "S!D4", "op": "<=", "value": 1000} (or "cell_ref") {"type": "column_check", "sheet": "Data", "expr": "Qty >= 0", "cell_range": "A1:F500"} {"type": "column_unique", "sheet": "Data", "column": "I…
| Parameter | Type | Description |
|---|---|---|
rules * | array | Rule objects, each with a unique id and a type (see tool description). An empty list removes all rules. |
on_unverifiable | string | What to do when a rule cannot be checked (e.g. LibreOffice missing): "warn" or "rollback". |
on_violation | string | "rollback": undo a write that breaks a rule. "warn": keep it and report. |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. |
check_rules Check rules
Check the workbook's rules (from set_rules) against its current values without writing.
| Parameter | Type | Description |
|---|---|---|
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. |
export_review_copy Export review copy
Write a copy for a human reviewer: cells changed since a baseline are highlighted with a Before/After comment. A `_Changes` sheet lists every change with a link. The workbook itself is not modified.
| Parameter | Type | Description |
|---|---|---|
baseline_path | Workbook to compare against. Default: this file's newest .bak backup. | |
highlight_color | string | Hex RGB fill for changed cells. |
include_recalc_changes | boolean | Also mark formulas whose text is the same but whose result changed. |
max_annotated_cells | integer | Highlight at most this many cells; all changes are still listed in _Changes. |
output_path | Where to write the copy. Default: "<name>.review.xlsx" next to the file. | |
overwrite | boolean | Replace an existing output file. |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. |
inspect_for_sharing Inspect for sharing
Report hidden or sensitive content to review before sharing a workbook. Covers hidden sheets, rows and columns, comments, document properties, external links, pivot caches, invisible text, embedded objects, macros, custom XML and the change log. Each finding says whether sanitize_copy can remove it.
| Parameter | Type | Description |
|---|---|---|
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. |
sanitize_copy Sanitize copy
Write a cleaned copy of the workbook for sharing (run inspect_for_sharing first). The source is not modified.
| Parameter | Type | Description |
|---|---|---|
output_path * | string | Path for the cleaned copy; must differ from the source. |
overwrite | boolean | Replace an existing output file. |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
remove | What to strip. Default: comments, document_properties, change_log. Hidden sheets are removed only when nothing refers to them; external links become their cached values. |
get_change_log Get change log
Read the change log stored inside the workbook, newest first: time, tool, cell, before/after, reason. Entries exist only for writes made while XLSX_MCP_CHANGE_LOG=true.
| Parameter | Type | Description |
|---|---|---|
cell | Only entries for this cell, including ranges that contain it. | |
limit | integer | Maximum entries (1-1000). |
path | File path or preloaded name (list_configured_files). Omit if only one file is preloaded. | |
sheet | Only entries for this sheet. |