Excel MCP Server
This server is a comprehensive Excel/CSV automation toolkit that lets an LLM create, read, modify, analyze, and transfer spreadsheet files through 69 MCP tools, 2 resources, and 20 prompts.
Workbook & sheet management: create workbooks, inspect metadata, rename/delete/copy/hide/recolor/move sheets, and write multiple sheets at once.
Cell & range operations: read/write single cells, ranges, or large sheets in chunks; copy, clear, transpose, and find/replace with regex.
Formatting & styling: apply fonts, colors, alignment, borders, number formats, named styles, auto-fit columns, merge/unmerge, and copy/clear formatting.
Conditional formatting: apply color scales, data bars, icon sets, highlight rules, formula/top-bottom/above-below-average rules, and list/remove rules.
Formulas: set, batch-write, drag-fill, auto-sum, and audit formulas (values, errors, precedents, dependents).
Tables: create, list, resize, read, toggle totals, and convert native Excel tables to ranges.
Data validation: add dropdown, numeric, date, and formula-based validation rules; remove rules.
Protection: protect/unprotect sheets and workbooks, lock cells, and configure allowed actions.
Charts: create/update/delete/list 10 chart types, add series, configure axes, trendlines, combo charts, data labels, and legends.
Data analysis: sort, filter, compute statistics, aggregate, find duplicates, profile data, value counts, subtotals, VLOOKUP enrichment, correlation, regression, and exponential smoothing.
Pivot & ETL: create/refresh pivot tables, unpivot, merge datasets with SQL-style joins, add computed columns, and deduplicate.
Financial calculations: IRR/FV/PV/NPER/RATE/depreciation, DCF, loan amortization, budget variance, financial ratios, break-even, goal seek, solver, sensitivity tables, and scenarios.
Data cleaning & CSV: run cleaning pipelines, split columns, parse dates, preview CSVs, and convert between CSV and XLSX.
Comments & hyperlinks: add/read/delete/list cell comments and internal/external hyperlinks.
Images & named ranges: insert images, and create/list/update/delete named ranges.
Worksheet operations: freeze panes, auto-filters, gridlines, row/column insert/delete, grouping, sizing, print setup, page breaks, and cross-sheet/cross-workbook transfers.
Multi-file operations: aggregate, filter, validate schema consistency, and compare data across multiple workbooks.
File transfer: upload files (base64/URL), download processed files as base64, and release session files to free disk space.
Custom code: run sandboxed Python/pandas code against a workbook for custom transformations when built-in tools are insufficient.
Enables GitHub Copilot to automate Excel and CSV files through MCP tools for workbook, sheet, cell, chart, and analysis operations.
Enables OpenAI's ChatGPT to interact with Excel and CSV files through MCP, supporting tasks from data cleaning to financial modeling.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Excel MCP Server create a bar chart from the sales data in Sheet1"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Excel MCP Server
A Python-based Model Context Protocol (MCP) server for Excel and CSV automation. It enables LLMs to work with .xlsx, .xlsm, .xls, and .csv files through 69 structured tools, 2 JSON resources, and 20 prompts spanning workbook operations, formatting, charts, ETL, analysis, financial/statistical workflows, and HTTP file transfer.
Features
NOTE: Custom actions are not supported as first-class tools. Use
execute_custom_codeas the sanctioned, sandboxed path for custom data transformations. This uses AST validation and blocks dangerous operations.
Workbook & Sheet Management
Create workbooks; inspect workbook metadata and per-sheet summaries.
Rename, delete, copy, move, hide/unhide, and recolour sheet tabs.
Write data to multiple sheets in a single call.
Related MCP server: Excel MCP Server
Cell & Range Operations
Read and write individual cells, contiguous ranges, and large sheets in chunks.
Include formulas and cell metadata when reading ranges.
Copy ranges, clear range values, transpose data, and search/replace with optional regex support.
Row & Column Operations
Insert and delete rows and columns by index.
Formatting & Styling
Apply fonts, colours, alignment, borders, and number formats to cells.
Use built-in number format presets and named Excel styles.
Merge and unmerge cells, auto-fit columns, clear formatting, and copy cell formatting.
Conditional Formatting
Apply colour scales, data bars, icon sets, and targeted highlight rules.
Add formula, top/bottom, and above/below-average rules; list and remove rules.
Formulas
Set single or batch formulas and drag-fill them across ranges with relative-reference translation.
Insert AutoSum formulas and audit formula values, errors, precedents, dependents, and sheet formulas.
Tables
Create, list, resize, and read native Excel tables.
Toggle totals rows and convert tables back to plain ranges.
Data Validation
Add dropdown, numeric, date, and formula-based validation rules.
Remove validation rules.
Protection
Protect and unprotect sheets and workbooks.
Lock individual cells.
Charts
Create, list, delete, and update charts across 10 chart types: column, bar, line, pie, scatter, area, radar, doughnut, bubble, and stock.
Add series and configure axes, trendlines, combo charts, data labels, legends, and category ranges.
Data Analysis
Filter and sort data by multiple conditions or columns.
Compute column statistics, grouped aggregates, value counts, and correlation matrices.
Find duplicates, profile datasets, insert subtotals, and perform VLOOKUP-style enrichment.
Run OLS regression and exponential smoothing with forecasting support.
CSV Operations
Preview CSV content.
Convert between CSV and XLSX formats.
Pivot & ETL
Create pivot tables and refresh them from stored definitions.
Unpivot wide data, merge datasets with SQL-style joins, and deduplicate rows.
Add computed columns with safe expressions, cumulative sums, or rolling calculations.
Financial Calculations
Run IRR, FV, PV, NPER, RATE, and depreciation time-value calculations.
Build DCF models, loan amortisation schedules, budget variance reports, financial ratio analysis, and break-even analysis.
Perform goal seek, constrained solver optimisation, sensitivity tables, and scenario analysis.
Data Cleaning
Run a configurable cleaning pipeline to trim whitespace, remove empty rows/columns, normalise text, fix number formats, deduplicate, and fill missing values.
Use preview mode before saving changes.
Split columns and parse/normalise date columns.
Comments
Add, read, delete, and list comments.
Hyperlinks
Add internal or external hyperlinks.
Read, delete, and list hyperlinks.
Images
Insert images into worksheets.
Named Ranges
Create, list, update, and delete named ranges.
Worksheet Operations
Freeze and unfreeze panes.
Set/remove auto-filters, and toggle gridlines.
Group/ungroup rows and columns; set row heights and column widths.
Configure print area, page setup, print titles, and manual page breaks.
Copy ranges across sheets, copy sheets across workbooks, merge workbooks, and stack sheets into a consolidated sheet.
Document Properties
Read workbook metadata and set calculation mode.
Cross-file Operations
Aggregate, filter, validate, and compare data across multiple files.
File Transfer
Upload files (base64, HTTP URL, or local path) for server-side processing.
Download processed files as base64.
Release session files to free server disk space.
Supports single and multi-file upload workflows.
69 Tools | 2 Resources | 20 Prompts
Prerequisites
Below are the requirements for running this MCP:
Python 3.12+
uv for dependency management and execution
Optional: Node.js (for running the MCP Inspector via
npx)
Setup & Run
Installing all project dependencies:
uv syncRunning in STDIO Mode (default)
uv run src/mcp_server/main.py # or: uv run excel-mcpThe default transport is STDIO, preserving compatibility with local CLI-based clients.
GitHub Copilot (VS Code) — STDIO
In .vscode/mcp.json:
{
"servers": {
"excel-mcp": {
"command": "uv",
"args": [
"run",
"--with",
"mcp[cli]",
"excel-mcp"
],
"env": {
"PYTHONPATH": "src"
}
}
}
}Running in HTTP Mode
uv run excel-mcp --transport http --host 127.0.0.1 --port 8765With defaults (host 127.0.0.1, port 8000):
uv run excel-mcp --transport httpGitHub Copilot (VS Code) — HTTP
In .vscode/mcp.json:
{
"servers": {
"excel-mcp-http": {
"url": "http://127.0.0.1:8765/mcp"
}
}
}Other MCP Clients
In the .vscode/mcp.json add:
"excel-mcp": {
"command": "uv",
"args": [
"run",
"--with",
"mcp[cli]",
"excel-mcp"
],
"env": {
"PYTHONPATH": "src"
}
}Anthropic Claude
Expose the MCP server via the stateless Streamable HTTP transport and register it with Claude/Claude Code for direct tool use. For development you can also use the MCP Inspector or run a small HTTP adapter that forwards Claude Messages to the MCP server.
Example (from research spec):
claude mcp add --transport http my-excel-mcp http://localhost:8000/mcpAnthropic Claude Code
Claude Code supports stdio, HTTP/SSE, and plugin-bundled MCP servers. For local development add a project-scoped .mcp.json or register a stdio command; for sharing use a plugin that bundles a .mcp.json entry.
Example (project .mcp.json from research spec):
{
"mcpServers": {
"excel-mcp": {
"type": "stdio",
"command": "uv",
"args": ["run", "src/mcp_server/main.py"],
"env": { "PYTHONPATH": "src" }
}
}
}OpenAI / ChatGPT
OpenAI supports an mcp tool via the Responses API (remote MCP/SSE or streamable HTTP), ChatGPT plugins (OpenAPI + ai-plugin.json), or a local function-calling wrapper that mediates calls to the local MCP server. Protect public endpoints with TLS/auth or prefer the local wrapper for private data.
Example (Responses API mcp tool from research spec):
from openai import OpenAI
client = OpenAI()
resp = client.responses.create(
model="gpt-5",
tools=[{
"type": "mcp",
"server_label": "excel-mcp",
"server_description": "Excel MCP server",
"server_url": "https://your-public-host.example.com/sse",
"authorization": "Bearer YOUR_MCP_TOKEN",
"require_approval": "always",
}],
input="Read first 20 rows from /tmp/demo.xlsx"
)
print(resp.output_text)Try it with the MCP Inspector
Inspect tools, resources, and prompts without an LLM in the loop:
npx @modelcontextprotocol/inspector uv run --directory . src/mcp_server/main.pyVerifications
Run tests with:
uv run pytest -vRun linting with:
uv run ruff check src/ tests/Run Pyrefly type checks with:
uv run pyrefly checkPrompts
The server ships 20 MCP prompts (src/mcp_server/prompts.py) for common workflows:
Prompt | Description |
| Create a new Excel workbook, populate it with formatted data, and auto-fit columns |
| Profile, filter, aggregate, sort, and find duplicates in an Excel dataset |
| Full data cleaning pipeline: profile, clean, validate, deduplicate, and export |
| Create, style, and annotate charts with trendlines, axis labels, data labels, and legends |
| Assemble a multi-sheet formatted report with data, charts, statistics, and print setup |
| Build a financial model workbook with loan amortisation, DCF analysis, and financial ratios |
| Create pivot tables and run ETL transforms: merge, unpivot, add computed columns |
| Aggregate, filter, compare, and validate schema consistency across multiple Excel files |
| Run OLS regression and exponential smoothing with forecasting on Excel data |
| Write, fill, auto-sum, and audit Excel formulas across a sheet |
| Apply data validation, protection, named ranges, and scenario management to a workbook |
| Preview a CSV, convert to Excel, clean, analyse, and export results |
| Inspect workbook structure, formulas, tables, and data quality without mutating the file |
| Diagnose formula errors, trace precedents and dependents, and apply the smallest safe fix |
| Perform conservative workbook housekeeping: sheets, layout, print setup, and sizing |
| Create, inspect, resize, total, and convert native Excel tables |
| Run goal seek, solver, sensitivity, and scenario analysis |
| Validate, compare, aggregate, and filter multiple files with schema checks |
| Find and repair text or formula content with a read-before-write workflow |
| Apply a sandboxed custom transform only when built-in tools are not enough |
Tools
This section merges the previous "Tool Overview" and the full grouped tool list. Each group includes a short description of its purpose and the individual tools provided by the server.
Workbook management (5) — Manage workbooks and sheets (create, inspect, rename, delete, copy, move)
get_workbook_metadata— Return workbook metadata (sheets, active sheet, named ranges).create_workbook— Create a new workbook file with optional initial sheets.get_sheet_summary— Summarise a sheet (header detection, used range, dimensions).write_multi_sheet— Create/overwrite a workbook from multiple sheet definitions.sheet_management— Rename, delete, copy, hide/unhide, tab color, and move sheets.
Cell & range operations (6) — Read and write cells/ranges and perform range transforms
read_cells— Read a single cell, a rectangular range, or stream large sheets in chunks.write_cells— Write a single cell, a 2D range, generate series, merge/unmerge ranges.clear_range— Clear values from a rectangular range.copy_range— Copy a range between sheets (values and/or styles, optional paste-values-only).find_replace— Find and replace text (optionally in formulas) across a sheet.transpose_range— Transpose rows↔columns and write the result at a target cell.
Formatting & styling (5) — Apply and manage cell formatting at scale
format_cells— Apply fonts, fills, alignment, borders and number formats to a range.auto_fit_columns— Auto-fit column widths to their contents.copy_cell_format— Copy formatting from a source cell to every cell in a target range.clear_cell_format— Remove formatting from a range without changing values.apply_named_style— Apply built-in Excel named styles (e.g. Heading, Good, Bad).
Formulas (2) — Write and audit formulas
formula_write— Set single formulas, batch-set, drag-fill, or insert AutoSum formulas.formula_audit— Inspect formula values, list errors, find precedents/dependents, or list formulas.
Charts (1) — Create and manage chart lifecycle and series
chart— Create, list, delete, update, add series, and configure axes, trendlines, combo charts, legends, and data labels.
Worksheet operations (4) — UI, structure, print and cross-workbook transfers
worksheet_view— Freeze panes, set/remove auto-filter, toggle gridlines.worksheet_structure— Insert/delete rows/cols, group/ungroup, set sizes.worksheet_print— Set print area, page setup, print titles, and page breaks.worksheet_transfer— Copy ranges across sheets within a workbook, copy sheets across workbooks, merge workbooks, and stack sheets.
Data analysis (9) — Filtering, aggregation, profiling and helper utilities
sort_data— Sort worksheet rows by one or more columns.column_statistics— Compute descriptive statistics for a numeric column.aggregate_data— Group rows and aggregate values using common operations.find_duplicates— Identify duplicate rows based on a set of columns.vlookup_helper— Cross-file lookup helper (exact or fuzzy matching) to enrich data.filter_data_advanced— Filter rows using multiple conditions combined with AND/OR logic.insert_subtotals— Insert SUBTOTAL formula rows after groups in a sorted sheet.profile_data— Produce a per-column data profile (types, nulls, unique counts, samples).value_counts— Frequency counts (optionally normalized, top-n) for a column.
Pivot & ETL (6) — Pivot tables and ETL-style transforms
create_pivot_table— Build a pivot table and optionally write it to a sheet/file.refresh_pivot_table— Re-run a stored pivot definition to refresh output.unpivot_data— Melt wide-form data into long-form (id_vars/value_vars).merge_datasets— Join two sheets using SQL-style join semantics.add_computed_column— Add a computed column via safe expressions or cumsum/rolling operations.deduplicate_data— Remove duplicate rows (with keep strategy) from a sheet.
Financial (8) — Time-value calculations, DCF, goal-seek and financial modelling tools
goal_seek— Solve for a variable cell value that makes an expression equal a target.loan_amortization— Generate an amortization schedule for a loan.dcf_analysis— Discounted cash flow valuation with terminal value calculation.budget_variance_analysis— Compare budget vs actual by category and report variances.financial_ratio_analysis— Compute common financial ratios and compare to benchmarks.break_even_analysis— Compute break-even units and revenue from cost structure.create_sensitivity_table— Build 1- or 2-variable sensitivity tables in the workbook.time_value_calc— FV/PV/NPER/RATE/depreciation/IRR operations and helpers.
Cleaning & CSV (4) — Data cleaning primitives and CSV helpers
split_column— Split a delimited text column into multiple columns.data_cleaner— Run a configurable cleaning pipeline (trim, dedupe, fill, normalize).parse_date_column— Parse varied date formats and normalise output formatting.csv_ops— Preview CSVs and convert between CSV and XLSX.
Statistical & solver (4) — Regression, smoothing and optimisation
run_regression— Run OLS regression and return coefficients and diagnostics.run_exponential_smoothing— Apply simple/Holt/Holt-Winters smoothing and optional forecasting.run_solver— Constrained optimisation using scipy for minimisation/maximisation objectives.correlation_matrix— Compute Pearson correlation matrix for numeric columns.
Governance (4) — Protection, validation, document properties and conditional formats
protection— Protect/unprotect sheets or workbooks and lock cell ranges.data_validation— Add/remove dropdown, numeric, date, and formula-based validation rules.doc_properties— Read document properties or set calculation mode.conditional_format— Apply, list, or remove conditional formatting rules.
Metadata & tables (5) — Comments, hyperlinks, scenarios, named ranges and tables
comment— Add, read, delete or list comments on cells.hyperlink— Add, read, delete or list hyperlinks attached to cells.scenario— Save, list and apply what-if scenarios persisted in a hidden sheet.named_range— List, create, delete or update named ranges.table— Create, list, resize, toggle totals, read, or convert Excel tables.
Multi-file operations (1) — Bulk and cross-workbook operations
multi_file— Aggregate, filter, validate, or compare across multiple workbooks.
File transfer (3) — Upload, download, and release session-managed files
upload_file— Upload a file via base64 or HTTP URL for server-side processing (supports single and multi-file uploads).download_file— Download a server-side file as base64 after processing.release_file— Release a session file and delete it from server disk.
Custom code & images (2) — Sandboxed code execution and images
insert_image— Insert an image into a worksheet anchored at a target cell.execute_custom_code— Run sandboxed Python/pandas code against a workbook and return results.
References
Available Tools
69 toolsadd_computed_columnA
Add a computed column either via pandas-eval formula or as a cumsum/rolling operation.
Args: file_path: Workbook path. sheet_name: Worksheet name. new_column_name: Column name to add. expression: Expression string for pandas.eval when column_type=='formula'. has_header: Whether the sheet has a header row. column_type: One of 'formula', 'cumsum', 'rolling'. source_col: Required for 'cumsum' and 'rolling'. window: Integer window for rolling operations. rolling_func: Aggregation for rolling (default 'mean').
Returns: str: Message indicating success and destination column.
Notes: - Accepts user-provided expressions — underlying code performs AST checks; docstring should link to safety doc.
Inputs: file_path (required), expression (required), sheet_name (required), new_column_name (required), +5 more. Returns: result
aggregate_dataBRead-only
Group rows by column(s) and aggregate values using the specified operation.
Args: file_path: Workbook path. sheet_name: Worksheet name. group_by: Column or list of columns to group by. value_column: Column to aggregate. operation: Aggregation operation (e.g. 'sum', 'mean', 'count'). has_header: Whether the sheet has a header row. aggfunc: Optional pandas-style aggfunc or mapping.
Returns: dict: Aggregated results (may be written to sheet if underlying tool provides an option).
Inputs: group_by (required), file_path (required), sheet_name (required), value_column (required), +3 more.
apply_named_styleA
Apply a named built-in Excel style to a range (e.g. 'Good', 'Heading 1').
Args: file_path: Workbook path. sheet_name: Worksheet name. range_str: Target range. style_name: Name of the named style to apply.
Returns: dict: Result metadata.
Notes: - Mutates formatting and depends on openpyxl named style availability.
Inputs: file_path (required), range_str (required), sheet_name (required), style_name (required).
auto_fit_columnsA
Auto-fit column widths to their contents for a worksheet.
Args: file_path: Workbook path. sheet_name: Worksheet name.
Returns: str: Success message.
Notes: - Mutates column widths and may be expensive on large sheets.
Inputs: file_path (required), sheet_name (required). Returns: result
break_even_analysisB
Calculate break-even units and revenue given fixed and variable costs.
Args: fixed_costs: Total fixed costs. price_per_unit: Selling price per unit. variable_cost_per_unit: Variable cost per unit.
Returns: dict: break_even_units and break_even_revenue.
Inputs: fixed_costs (required), price_per_unit (required), variable_cost_per_unit (required).
budget_variance_analysisA
Compare budget vs actual values in a sheet and return variances per category.
Args: file_path: Workbook path. sheet_name: Worksheet name. category_column, budget_column, actual_column: Column identifiers for the analysis. header_row: 1-based header row index. output_file: Optional path to write results.
Returns: dict: Per-category variance and status.
Notes:
- Mutates workbook only if output_file provided.
Inputs: file_path (required), header_row, sheet_name, output_file, +3 more.
chartB
Perform chart lifecycle and series/configuration operations on a worksheet.
Args:
action: One of "create", "delete", "list", "add_series", "set_axes", "trendline", "combo", "data_labels", "legend", "update".
- "create": create a chart from data_range at target_cell; optional categories_range overrides x-axis category labels.
- "delete": remove a chart (optionally chart_index). Destructive.
- "list": return list of charts (read-only).
- "add_series": add a series to an existing chart (requires chart_index, data_range).
- "set_axes": configure axis titles/ranges/number format; optional categories_range sets x-axis category labels.
- "trendline": add a trendline to a series.
- "combo": create a combo chart; requires bar_columns and line_columns.
- "data_labels": configure data labels by chart_title.
- "legend": configure legend by chart_title.
- "update": update basic title/size/anchor of an existing chart.
file_path: Workbook path.
sheet_name: Worksheet name containing chart or data.
chart_index: Optional index of target chart (default 0 or required for some actions).
data_range: Range string used for chart creation or series.
chart_type: Chart kind (e.g. "column", "line").
target_cell: Anchor cell for new chart.
... (other visual/series parameters)
Returns: str or list[ChartInfo]: Created chart id/string or list of ChartInfo for "list".
Raises:
ValueError: If required parameters are missing for the selected action.
Notes: - Dispatch mapping: see function source; common destructive actions include "delete". - Chart creation mutates the workbook; consider documenting expected anchor and sizing units.
Inputs: action (required), file_path (required), sheet_name (required), name, +36 more. Returns: result
clear_cell_formatA
Clear formatting from cells in range_str without altering cell values.
Args: file_path: Workbook path. sheet_name: Worksheet name. range_str: Range whose formatting should be reset.
Returns: dict: Summary of cleared cells.
Notes: - Non-destructive to cell values but destructive to formatting state.
Inputs: file_path (required), range_str (required), sheet_name (required).
clear_rangeADestructive
Clear values from a rectangular range of cells.
Args: file_path: Path to workbook. sheet_name: Worksheet name. start_cell: Top-left cell of range to clear. end_cell: Bottom-right cell of range to clear.
Returns: str: Success message.
Raises: (Propagates exceptions from the underlying tools on I/O or invalid ranges.)
Notes: - Destructive: clears cell values (but not necessarily styles) — mention in API docs.
Inputs: end_cell (required), file_path (required), sheet_name (required), start_cell (required). Returns: result
column_statisticsARead-only
Compute descriptive statistics for a numeric column (mean, median, std, min, max, sum).
Args: file_path: Workbook path. sheet_name: Worksheet name. column: Column name or letter to analyse. has_header: Whether the sheet has a header row.
Returns: ColumnStats: Pydantic model with statistical measures.
Notes: - Read-only.
Inputs: column (required), file_path (required), sheet_name (required), has_header. Returns: Descriptive statistics for a single numeric column. Attributes: column (str): C…
commentA
Add, read, delete or list cell comments on a sheet.
Args:
action: "add", "read", "delete", or "list".
- "add": requires cell_ref and text; optional author.
- "read": requires cell_ref; returns CommentInfo or None.
- "delete": requires cell_ref; destructive.
- "list": returns list of CommentInfo for the sheet.
file_path: Workbook path.
sheet_name: Worksheet name.
cell_ref: Cell reference for single-cell operations.
text: Comment text for "add".
author: Optional author string.
Returns: str | CommentInfo | list[CommentInfo] | None: Depends on action.
Notes: - Deletions mutate the workbook.
Inputs: action (required), file_path (required), sheet_name (required), text, +2 more. Returns: result
conditional_formatA
Apply, list, or remove conditional formatting rules on a sheet.
Args: action: One of "apply", "highlight", "formula_rule", "remove", "top_bottom", "above_below_average", "list". file_path, sheet_name: Target workbook and sheet. cell_range: Range to apply/remove rules. format_type, start_color, mid_color, end_color, bar_color, icon_style: Visual rule parameters. operator, formula: Rule parameters for highlight/formula rules. font_color, bg_color, is_top, rank, percent, is_above, equal_average: Additional rule params.
Returns: str | dict | list: Depends on action.
Notes: - Removing rules is destructive to formatting state. - Consider documenting rule precedence and Excel-specific limitations.
Inputs: action (required), file_path (required), sheet_name (required), rank, +16 more. Returns: result
copy_cell_formatA
Copy formatting from a single source cell to every cell in a target range.
Args: file_path: Workbook path. sheet_name: Worksheet name. source_cell: Reference of the cell to copy formatting from. target_range: Range to apply the copied format.
Returns: dict: Summary of changed cells.
Notes: - Mutates formatting; does not touch values.
Inputs: file_path (required), sheet_name (required), source_cell (required), target_range (required).
copy_rangeA
Copy a range of cells to a destination range (same workbook or across sheets).
Args: file_path: Source workbook path (when copying within same workbook). source_sheet: Source worksheet name. source_range: Range to copy (e.g. "A1:B10"). dest_sheet: Destination worksheet name. dest_range: Destination top-left target (e.g. "C1"). copy_values: If True, copy values. copy_styles: If True, copy styles. paste_values_only: If True, read resolved values and write values (not formulas).
Returns: str: Success message.
Notes:
- May open the workbook twice if paste_values_only is True (read-only pass then write pass).
Inputs: file_path (required), dest_range (required), dest_sheet (required), source_range (required), +4 more. Returns: result
correlation_matrixARead-only
Compute a Pearson correlation matrix for numeric columns.
Args: file_path: Workbook path. sheet_name: Worksheet name. columns: Optional list of column names to include. If None, all numeric columns are used. output_sheet: Optional sheet name to write the matrix. output_file: Optional file path to write results. header_row: 1-based header index.
Returns: dict: {"columns": [...], "matrix": [[float, ...], ...]}.
Notes:
- Read-only unless output_sheet/output_file is set.
Inputs: file_path (required), sheet_name (required), columns, header_row, +2 more.
create_pivot_tableA
Build a pivot table from a source sheet and optionally write it to output_sheet/output_file.
Args: file_path: Workbook path. sheet_name: Source data sheet. index_cols: List of column names to use as index (rows). value_cols: Columns to aggregate. aggfunc: Aggregation function or dict (e.g. "sum", "mean" or {col: "sum"}). output_sheet: Optional destination sheet for pivot output. output_file: Optional file to write the pivot output. column_field: Optional field used for pivot columns. date_freq: Optional date grouping alias (e.g. 'ME', 'YE', 'W').
Returns: dict: Details about output including created sheet and saved pivot metadata.
Notes:
- Writes to workbook when output_sheet/output_file is provided. Stores pivot definitions in _mcp_pivots for refresh.
Inputs: file_path (required), index_cols (required), sheet_name (required), value_cols (required), +5 more.
create_sensitivity_tableA
Create a 1- or 2-variable sensitivity table in the workbook.
Evaluates expression over supplied value grids.
Args: file_path: Workbook path. sheet_name: Worksheet containing the base formula or output cell. output_cell: Cell that contains or references the expression to evaluate. expression: Expression that will be evaluated relative to variable names. var1_name, var1_values: Name and values for variable 1. var2_name, var2_values: Optional name/values for a second variable (two-way table).
Returns: dict: Summary including output range and written values.
Notes: - Mutates workbook by inserting the table; confirm overwrite semantics when the target output area overlaps data.
Inputs: file_path (required), var1_name (required), expression (required), sheet_name (required), +4 more.
create_workbookA
Create a new Excel workbook at file_path with optional initial sheets.
Args: file_path: Destination path for the new workbook. sheet_names: Optional list of sheet names to create. sheet_name: Optional single sheet name (legacy convenience).
Returns: WorkbookCreatedResult: Contains file path and sheet information.
Notes: - Mutates filesystem by creating a new .xlsx. Parent directory will be created if permitted by utils.
Inputs: file_path (required), sheet_name, sheet_names. Returns: Confirmation returned after creating a new workbook. Attributes: file_path (str…
csv_opsA
CSV helper operations: preview CSV, convert CSV→XLSX, and export XLSX→CSV.
Args:
action: "preview", "to_xlsx", or "to_csv".
- "preview": requires file_path (CSV path); returns a small preview as dict.
- "to_xlsx": requires csv_path (or file_path) and xlsx_path (or output_path).
- "to_csv": requires file_path (XLSX) and output_path (CSV destination).
file_path, csv_path, xlsx_path, output_path: Path parameters as described above.
sheet_name: Sheet to export when converting XLSX→CSV.
rows: Number of preview rows to return.
delimiter, encoding: CSV parameters.
Returns: dict or str: Preview dict for "preview" or destination path for conversions.
Raises:
ValueError: If required path parameters are missing for the selected action.
Notes: - "to_xlsx" and "to_csv" perform file writes; document whether they overwrite existing files.
Inputs: action (required), rows, csv_path, encoding, +5 more. Returns: result
data_cleanerA
Run a pipeline of cleaning operations (trim, dedupe, fill missing, normalize, etc.) on a sheet.
Args: file_path: Workbook path. sheet_name: Worksheet to operate on. operations: Ordered list of operations to run (see tool docs for allowed names). columns: Optional subset of columns to target. preview: If True, return a preview without persisting changes. output_file: Optional path to write cleaned results. header_row: 1-based header index. fill_missing_strategy: Strategy name for filling missing values. fill_value: Literal value to use if strategy is "value".
Returns: dict: Summary including rows modified and operations applied.
Notes:
- Document allowed operations strings in the route or underlying tool docs.
Inputs: file_path (required), columns, preview, fill_value, +5 more.
data_validationA
Add or remove data validation rules on a cell range.
Args: action: "dropdown", "numeric", "date", "remove", or "formula". file_path, sheet_name: Target workbook and sheet. cell_range: Range to apply validation. options: For dropdown lists, list of allowed values. source_range: Alternative dropdown source range. operator, value1, value2: Numeric operator and bounds for numeric validation. date1, date2: Date bounds for date validation. allow_blank, error_style, error_title, error_message, prompt_title, prompt_message: UX controls. formula: Custom formula when action=="formula".
Returns: str or dict: Result or validation metadata.
Notes: - "remove" is destructive for validation rules; this does not delete values, only rules.
Inputs: action (required), file_path (required), cell_range (required), sheet_name (required), +15 more. Returns: result
dcf_analysisARead-only
Compute Discounted Cash Flow valuation with a Gordon Growth Model terminal value.
Args: cash_flows: List of cash flows (period-ordered), first item normally year 0 investment (negative). discount_rate: Discount rate as decimal. terminal_growth_rate: Perpetuity growth for terminal value. initial_investment: Optional initial outlay to include in NPV.
Returns: dict: NPV, terminal value, IRR and breakdowns.
Inputs: cash_flows (required), discount_rate (required), initial_investment, terminal_growth_rate.
deduplicate_dataADestructive
Remove duplicate rows from a sheet, optionally using a subset of columns.
Args: file_path: Workbook path. sheet_name: Worksheet name. columns: Optional list of columns to consider for duplicates. keep: Which duplicate to keep: 'first', 'last', or False (drop all duplicates).
Returns: str: Summary message and number of rows removed.
Notes:
- Destructive: modifies the workbook unless an output_file variant is implemented upstream.
Inputs: file_path (required), sheet_name (required), keep, columns. Returns: result
doc_propertiesA
Read document properties or set calculation mode.
Args: action: "get" or "set_calc_mode". file_path: Workbook path. calc_mode: "auto", "manual", or "autoNoTable" for setting calculation mode.
Returns: dict or str: Properties dict for "get"; status message for "set_calc_mode".
Notes: - Changing calc mode changes workbook behaviour for formula recalc; mention effect in docs.
Inputs: action (required), file_path (required), calc_mode. Returns: result
download_fileARead-only
Download a file from the server as base64.
Use after tools that modify a workbook to retrieve the updated file content.
Args: file_path: Local path to the file (typically from upload_file or a tool that created a file).
Returns: dict: A mapping containing: - file_content (str): Base64-encoded file bytes. - filename (str): Basename of the file. - size_bytes (int): Size of the file in bytes.
Inputs: file_path (required).
execute_custom_codeA
Execute sandboxed Python/pandas code against a workbook or sheet and return result.
Args:
file_path: Path to source workbook to load into the sandbox.
code: Python code string. Sandbox exposes df (pandas.DataFrame), pd (pandas), np (numpy).
sheet: Optional sheet name to load into df. If omitted, the first sheet or a default is used.
output_file: Optional path to write results back to a workbook.
Returns:
dict: Execution result, typically containing result (from user code), stdout and errors.
Raises: ValueError: If code fails safety checks in the sandbox.
Notes: - High-risk: sandbox uses AST checks — document the allowed AST nodes and forbidden names. - Recommend returning a short example snippet of a safe operation in the route docs.
Inputs: code (required), file_path (required), sheet, output_file.
filter_data_advancedA
Filter rows using multiple conditions combined with AND/OR logic.
Args: file_path: Workbook path. sheet_name: Worksheet name. conditions: List of filter conditions, each with 'column' (str), 'operator' (str), and 'value'. logic: "AND" or "OR" to combine conditions. output_sheet: Optional sheet to write filtered output. header_row: 1-based header row index.
Returns: dict: Filtered rows or summary.
Inputs: file_path (required), conditions (required), sheet_name (required), logic, +2 more.
financial_ratio_analysisARead-only
Compute common financial ratios from raw financial metric inputs and compare them to benchmarks.
Args: financial_data: Dict of raw metric values keyed by component name. Valid keys: current_assets, current_liabilities, inventory, total_debt, total_equity, net_income, total_assets, revenue, gross_profit, operating_income, ebitda, interest_expense. E.g. {"current_assets": 500000, "current_liabilities": 250000}. industry_benchmarks: Optional dict of benchmark ratio values to compare against, e.g. {"current_ratio": 2.0, "roe": 0.15}.
Returns: dict: Computed ratios and optional benchmark comparisons.
Notes: - This function is pure math and does not touch files.
Inputs: financial_data (required), industry_benchmarks.
find_duplicatesARead-only
Identify duplicate rows based on a list of columns.
Args: file_path: Workbook path. sheet_name: Worksheet name. columns: Columns used to determine duplicates. has_header: Whether the sheet has a header row.
Returns: dict: Duplicate groups and row indices.
Inputs: columns (required), file_path (required), sheet_name (required), has_header.
find_replaceA
Find and replace text across a worksheet.
Args: file_path: Path to workbook to modify. sheet_name: Worksheet name. find_text: Substring or pattern to find. replace_text: Replacement text. match_case: Case-sensitive search when True. match_entire_cell: Match entire cell contents exactly when True. search_formulas: Also search within formulas when True. regex: Treat find_text as a regular expression when True.
Returns: dict: {"count": int, "cells": ["A1", ...]} detailing replacements.
Notes: - Destructive: modifies cells in-place. - Consider returning per-cell before/after pairs for audit logging in high-risk contexts.
Inputs: file_path (required), find_text (required), sheet_name (required), replace_text (required), +4 more.
format_cellsA
Apply font, fill, alignment, borders and number formats to a cell range.
Args:
file_path, sheet_name: Target workbook and sheet.
cell_range: Range to format.
bold, italic, font_size, font_color, bg_color: Font and fill controls.
number_format: Custom number format string.
horizontal_alignment, vertical_alignment: Alignment enums.
wrap_text, border_style, border_color, font_name, underline, strikethrough, text_rotation, indent, shrink_to_fit: Formatting options.
top_border_style, bottom_border_style, left_border_style, right_border_style: Per-side border overrides.
number_format_preset: Named preset from NUMBER_FORMAT_PRESETS.
preserve_existing: If True, do not overwrite unspecified style attributes.
Returns: str: Result message.
Notes: - Mutates formatting in workbook; recommend documenting idempotency when called multiple times with same args.
Inputs: file_path (required), cell_range (required), sheet_name (required), bold, +22 more. Returns: result
formula_auditARead-only
Inspect formulas: get cached value, list errors, find precedents/dependents, or list all formulas.
Args: action: "value", "errors", "precedents", "dependents", or "list". file_path, sheet_name: Workbook and sheet. cell_ref: Required for "value", "precedents", and "dependents". cell_range: Optional range filter for "errors".
Returns: dict or list: Action-dependent payload (e.g. value, list of FormulaErrorInfo, list of cell refs).
Notes: - Read-only.
Inputs: action (required), file_path (required), sheet_name (required), cell_ref, +1 more. Returns: result
formula_writeA
Set, batch-set, fill or auto-sum formulas in cells.
Args:
action: "set", "batch", "fill", or "auto_sum".
- "set": requires cell_ref and formula (is_array optional, target_range optional).
- "batch": requires formulas dict mapping cell_ref to formula string, e.g. {"A1": "=SUM(B1:B10)", "A2": "=AVERAGE(C1:C10)"}.
- "fill": requires cell_ref (source) and target_range.
- "auto_sum": requires cell_ref (destination) and optional source_range.
file_path, sheet_name: Workbook and sheet to modify.
is_array: Whether the formula is an array formula.
target_range, formulas, source_range: Operation-specific params.
Returns: str | dict: Success message or batch result.
Notes:
- Writing formulas mutates the workbook. fill uses formula translation utilities; verify absolute/relative reference behaviour.
Inputs: action (required), file_path (required), sheet_name (required), formula, +5 more. Returns: result
get_sheet_summaryARead-only
Return a brief summary of a sheet: header row, used range, row/column counts and detected headers.
Args: file_path: Workbook path. sheet_name: Worksheet to summarise.
Returns: SheetSummary: Pydantic model with summary fields.
Notes: - Read-only.
Inputs: file_path (required), sheet_name (required). Returns: High-level summary of a worksheet's contents. Attributes: name (str): Worksheet…
get_workbook_metadataARead-only
Return workbook metadata including sheet names, active sheet, dimensions, and named ranges.
Args: file_path: Path to the workbook to inspect.
Returns: WorkbookMetadata: Pydantic model containing sheet list, active sheet, named ranges, and other metadata.
Notes: - Read-only operation. Underlying implementation may use a lightweight reader for speed.
Inputs: file_path (required). Returns: Full metadata for an Excel workbook. Attributes: file_path (str): Absolute path…
goal_seekA
Find a variable cell value that makes an expression evaluate to a target and write the result.
Args: file_path: Workbook path. sheet_name: Worksheet containing the expression. variable_cell: Cell reference to adjust (e.g. "B2"). expression: Arithmetic expression referencing worksheet cells (string). target_value: Numeric target value for the expression. initial_value: Starting guess for the solver. tolerance: Convergence tolerance. max_iterations: Maximum solver iterations.
Returns: dict: Result with solved value, status, and iterations used.
Notes: - Destructive: writes the solved value back to the workbook. - Recommend adding a short example expression in docs.
Inputs: file_path (required), expression (required), sheet_name (required), target_value (required), +4 more.
hyperlinkA
Add, read, delete, or list hyperlinks attached to cells.
Args: action: One of "add", "read", "delete", "list". file_path: Workbook path. sheet_name: Worksheet name. cell_ref: Cell reference (required for single-cell ops). url: URL for "add". display_text, tooltip: Optional display and tooltip text.
Returns: str | HyperlinkReadResult | list[HyperlinkInfo] | None
Notes: - Deleting hyperlinks modifies the workbook.
Inputs: action (required), file_path (required), sheet_name (required), url, +3 more. Returns: result
insert_imageA
Insert an image into a worksheet anchored at a target cell.
Args: file_path: Workbook path to modify. sheet: Worksheet name. image_path: Path to image (PNG/JPG/GIF). cell: Anchor cell where image is placed. width: Optional width in Excel units. height: Optional height in Excel units.
Returns: dict: Metadata about the inserted image (anchor, size, file used).
Notes: - Mutates workbook and depends on Pillow. Document supported image formats and sizing behaviour.
Inputs: cell (required), sheet (required), file_path (required), image_path (required), +2 more.
insert_subtotalsA
Insert SUBTOTAL formula rows after each group in a sorted sheet.
Args: file_path: Workbook path. sheet_name: Worksheet name. group_col: Column used to group rows. value_col: Column to subtotal. subtotal_func: Excel subtotal function code (9=SUM by default). include_grand_total: Whether to append a grand total row.
Returns: dict: Summary including ranges where subtotals were inserted.
Notes: - Destructive: modifies the sheet structure and inserts new rows.
Inputs: file_path (required), group_col (required), value_col (required), sheet_name (required), +2 more.
loan_amortizationA
Generate a loan amortization schedule for given principal, rate and term.
Args: principal: Loan principal amount. annual_rate: Annual interest rate (fractional, e.g. 0.05 for 5%). years: Term in years. payments_per_year: Payment frequency (default 12).
Returns: dict: Schedule rows and totals including payment amount, interest, principal breakdown.
Inputs: years (required), principal (required), annual_rate (required), payments_per_year.
merge_datasetsA
Join two sheets within the workbook similar to SQL join semantics.
Args: file_path: Path to workbook. sheet1, sheet2: Names of the two sheets to join. join_key: Column name(s) common to both sheets (shorthand for left_on/right_on). how: One of "left", "right", "inner", "outer". output_sheet: Optional sheet name to write merged results. left_on, right_on: Optional explicit join keys for differently named columns.
Returns: dict: Key counts and output information.
Inputs: sheet1 (required), sheet2 (required), file_path (required), how, +4 more.
multi_fileB
Perform cross-workbook operations: aggregate, filter, validate schema consistency, compare two workbooks.
Args:
action: "aggregate", "filter", "validate", or "compare".
- "aggregate": requires file_paths and column; returns aggregated metric.
- "filter": requires file_paths, column, operator, value; returns filtered rows or writes to output_file.
- "validate": requires file_paths and key_column; checks schema/consistency across files.
- "compare": requires file_a and file_b; returns diff summary and optionally writes a report.
file_paths, file_a, file_b: File list / pair for relevant actions.
column, operation, operator, value: Parameters for aggregation/filtering.
output_file: Optional path to write the result.
Returns: dict: Operation-specific result (e.g. aggregation numbers, diffs, validation errors).
Notes:
- When output_file is provided operations may write new files — document overwrite policy.
Inputs: action (required), value, column, file_a, +12 more.
named_rangeA
List, create, delete, or update named ranges within a workbook.
Args: action: "list", "create", "delete", or "update". file_path: Workbook path. name: Named range name for create/delete/update. destination: Destination range string for create. scope: "workbook" or sheet-scoped identifier. new_destination: New range for update.
Returns: list[NamedRangeInfo] | str
Notes: - Creating/updating named ranges mutates workbook metadata but typically does not alter cell values.
Inputs: action (required), file_path (required), name, scope, +2 more. Returns: result
parse_date_columnADestructive
Parse varying date formats in a column and write normalized results to an output column.
Args:
file_path: Workbook path.
sheet_name: Worksheet name.
column: Column to parse.
output_column: Optional target column; if omitted, overwrites column.
output_format: Strftime format for normalized output.
dayfirst: Whether to parse day-first dates.
header_row: 1-based header index.
Returns: dict: Summary including number of parsed rows and parse errors.
Notes:
- Destructive by default when output_column targets existing column.
Inputs: column (required), file_path (required), sheet_name (required), dayfirst, +3 more.
profile_dataARead-only
Produce a data profile for a sheet or range listing types, null counts, unique counts and samples.
Args: file_path: Workbook path. sheet: Optional sheet name. data_range: Optional range to restrict profiling.
Returns: dict: Per-column profile metadata.
Notes: - Read-only.
Inputs: file_path (required), sheet, data_range.
protectionA
Sheet and workbook protection utilities.
Args: action: One of "protect_sheet", "unprotect_sheet", "protect_cells", "protect_workbook", "unprotect_workbook". file_path: Workbook path. sheet_name: Sheet name for sheet-scoped operations. password: Optional password string used for protection/unprotection. locked_range: Range to lock for "protect_cells". unlocked_ranges: List of ranges allowed for edits. allow_*: Flags controlling allowed operations on protected sheets.
Returns: str: Result message.
Notes: - Protect/unprotect modify workbook security. Warn users about lost passwords.
Inputs: action (required), file_path (required), password, allow_sort, +13 more. Returns: result
read_cellsARead-only
Read cell data from a worksheet.
Args:
mode: One of "single", "range", or "chunked". Determines the behaviour and required parameters.
- "single": returns a single cell value. Requires cell_ref.
- "range": returns a rectangular range. Requires start_cell and end_cell.
- "chunked": returns a chunked reader result for large sheets. Optional: start_row, chunk_size.
file_path: Path to the workbook (validated by utils).
sheet_name: Worksheet name.
cell_ref: Cell reference for single-cell reads (e.g. "A1").
start_cell: Top-left cell for range reads.
end_cell: Bottom-right cell for range reads.
include_formula: If True, include formula text when available.
include_metadata: If True, include additional metadata (styles, comment presence, etc.).
show_formula: For range reads, include formulas instead of values when True.
show_style: For range reads, include style information when True.
output_format: Format for range output; typically "json".
max_cells: Maximum cells to return for range reads (to avoid huge payloads).
start_row: For chunked reads, starting row index (0-based).
chunk_size: Number of rows per chunk for chunked reads.
Returns:
dict or ChunkReadResult: Single value, range payload, or chunked reader object depending on mode.
Raises:
ValueError: If required parameters for the chosen mode are missing or mode is unknown.
Notes:
- Read-only: this function only reads workbook data and should not mutate files.
- Dispatch mapping: "single"→tools.cell_ops.read_cell, "range"→tools.cell_ops.read_range, "chunked"→tools.cell_ops.read_file_chunked.
Inputs: mode (required), file_path (required), sheet_name (required), cell_ref, +10 more. Returns: result
refresh_pivot_tableA
Refresh a previously created pivot table by re-running its stored definition.
Args: file_path: Workbook path containing stored pivot definitions. output_sheet: Name of the pivot output sheet to refresh. source_file_path, source_sheet: Optional explicit sources to override stored sources.
Returns: dict: Summary of refresh results.
Notes: - Mutates the workbook by overwriting the pivot output area.
Inputs: file_path (required), output_sheet (required), source_sheet, source_file_path.
release_fileADestructive
Release a session file and delete it from the server.
Call this when you are done with a file to free server disk space.
Args: session_id: The session_id returned by upload_file.
Returns: dict: A mapping containing: - success (bool): Whether the file was successfully released. - message (str): Human-readable result description.
Inputs: session_id (required).
run_exponential_smoothingBRead-only
Apply exponential smoothing (simple/Holt/Holt-Winters) to a time series column.
Args: file_path: Workbook path. sheet_name: Worksheet name. column: Column to smooth. alpha: Smoothing factor for simple smoothing. new_column_name: Optional name for output column; if omitted, a generated name is used. header_row: 1-based header index. output_file: Optional file to write output. method: One of "simple", "holt", "holt_winters". seasonal_periods: Required for Holt-Winters. forecast_steps: Number of out-of-sample forecast steps to produce. smoothing_trend, smoothing_seasonal: Optional fixed smoothing parameters.
Returns: dict: Summary and references to output column/sheet.
Notes:
- May modify workbook if output_file/new_column_name provided.
Inputs: column (required), file_path (required), sheet_name (required), alpha, +8 more.
run_regressionARead-only
Run an OLS linear regression and optionally write results to a sheet/file.
Args: file_path: Input workbook path. sheet_name: Worksheet containing data. y_column: Dependent variable column name. x_columns: List of independent variable column names. header_row: 1-based header row index. output_sheet: Optional sheet name for regression output. output_file: Optional path to write results to a separate file.
Returns: RegressionResult: Contains coefficients, R-squared, residuals and diagnostics.
Notes:
- Read-only unless output_file/output_sheet is provided (then mutates workbook/creates file).
Inputs: y_column (required), file_path (required), x_columns (required), sheet_name (required), +3 more. Returns: equation, f_pvalue, p_values, ss_total, +12 more
run_solverA
Run constrained optimisation using scipy to minimise (or maximise) an objective built from cell references.
Args: file_path: Workbook path. sheet_name: Worksheet providing objective or referenced cells. objective_expression: Arithmetic expression using cell refs (e.g. "B2 * B3 - B4"). variable_cells: Mapping of cell_ref to bounds, e.g. {"B2": {"lower": 0, "upper": 100}}. constraints: Optional list of solver constraints, each with 'expression' and 'type' ('ineq' or 'eq'). maximize: If True, the objective is maximised instead of minimised. tolerance: Convergence tolerance. max_iterations: Maximum solver iterations.
Returns: SolverResult: Contains solution, status, and diagnostics.
Notes: - May write back solution values into the workbook depending on implementation — document write semantics.
Inputs: file_path (required), sheet_name (required), variable_cells (required), objective_expression (required), +4 more. Returns: message, converged, iterations, found_values, +1 more
scenarioA
Manage saved scenarios (what-if value sets) persisted in a hidden sheet.
Args:
action: "add", "list", or "apply".
- "add": requires name and cell_values — a nested dict mapping sheet name to {cell_ref: value},
e.g. {"Sheet1": {"A1": 100, "B2": 200}, "Sheet2": {"C3": "hello"}}.
- "list": returns available scenarios.
- "apply": requires name and will write stored cell values into the workbook (destructive).
file_path: Workbook path.
name: Scenario name for add/apply.
cell_values: Nested dict mapping sheet_name → {cell_ref: scalar_value} for "add".
description: Optional free-text description.
Returns: str | list[ScenarioInfo] | ScenarioApplyResult
Notes:
- Scenarios are stored in a hidden _mcp_scenarios sheet — mention potential
user-visible side-effects when users open the workbook.
Inputs: action (required), file_path (required), name, cell_values, +1 more. Returns: result
sheet_managementA
Manage sheets within a workbook (rename, delete, copy, hide/unhide, set tab color, move order).
Args:
action: One of "rename", "delete", "copy", "hide", "unhide", "tab_color", "move".
- "rename": requires new_name.
- "delete": deletes the sheet; destructive.
- "copy": requires new_name for the copy.
- "hide": hides the sheet (cannot hide all visible sheets).
- "unhide": unhides the sheet.
- "tab_color": requires color (6-char hex) to set or "000000" to clear.
- "move": requires offset (int) to shift position.
file_path: Workbook path.
sheet_name: Target sheet name for the action.
new_name: New name for rename/copy.
color: Tab color hex string for "tab_color".
offset: Position offset for "move" (positive = right).
Returns: str or dict: Operation result or metadata.
Raises: ValueError: When required arguments for an action are missing.
Notes:
- Dispatch mapping: "rename"→tools.workbook.rename_sheet, "delete"→tools.workbook.delete_sheet,
"copy"→tools.workbook.copy_sheet, "hide"→tools.workbook.hide_sheet, etc.
- Deletions and moves are destructive operations and should be annotated in external docs and UIs.
Inputs: action (required), file_path (required), sheet_name (required), color, +2 more. Returns: result
sort_dataA
Sort worksheet rows by one or more columns and write back the result.
Args:
file_path: Workbook path.
sheet_name: Worksheet to sort.
sort_by: List of sort descriptors, each with 'column' (str) and optional 'ascending' (bool, default True).
column: Convenience single-column sort (deprecated in favour of sort_by).
ascending: Boolean default sort order when column is used.
has_header: Whether the sheet has a header row.
Returns: str: Result message.
Notes: - Destructive: overwrites sheet rows.
Inputs: file_path (required), sheet_name (required), column, sort_by, +2 more. Returns: result
split_columnA
Split a single text column into multiple columns using a delimiter.
Args: file_path: Path to workbook. sheet_name: Worksheet name. column: Column letter or header name to split. delimiter: Delimiter string (default ","). new_columns: Optional list of new column names. drop_original: If True, remove the original column after split. output_file: Optional path to write results instead of overwriting input. header_row: 1-based header row index.
Returns: dict: Summary of created columns and row counts.
Notes:
- Destructive unless output_file is provided.
Inputs: column (required), file_path (required), sheet_name (required), delimiter, +4 more.
tableA
Create, list, resize, toggle totals, read data, or convert tables to ranges.
Args: action: "create", "list", "resize", "totals", "data", or "convert_to_range". file_path: Workbook path. sheet_name: Worksheet containing the table. table_name: Table name for operations that require it. data_range: Range to use when creating a table. style_name: Named table style for creation. new_range: New range for resize. show_totals: Bool for toggling totals row. column_totals: Dict mapping column name to aggregation function name (e.g. {"Revenue": "sum", "Quantity": "count"}). Valid functions: sum, count, average, max, min, countNums, stdDev, var, none.
Returns: str | list[TableInfo] | dict
Notes: - Table creation/resizing mutates workbook structure.
Inputs: action (required), file_path (required), sheet_name (required), new_range, +5 more. Returns: result
time_value_calcCRead-only
Perform a variety of time-value-of-money calculations and depreciation methods.
Args: operation: One of "fv", "pv", "nper", "rate", "depreciation", "irr". rate, nper, pmt, pv, fv, when, guess: Parameters depending on operation. cost, salvage, life, method, period: Parameters for depreciation operations. cash_flows: For IRR, list of floats.
Returns: dict: Operation-specific outputs (e.g. numeric answer, schedule, irr value).
Raises: ValueError: If required args for the selected operation are missing.
Notes: - Pure calculations except for methods that may write results when integrated into workbook workflows.
Inputs: operation (required), fv, pv, pmt, +10 more.
transpose_rangeA
Transpose a source range (rows↔columns) and write starting at target_cell.
Args:
file_path: Path to workbook.
sheet_name: Target worksheet name (destination for transposed data).
source_range: Range to transpose (on sheet_name by default).
target_cell: Top-left cell for the transposed output.
source_sheet: Optional source sheet name if different from sheet_name.
paste_values_only: If True, paste only resolved values (no formulas).
Returns: dict: Summary including target range written and number of cells.
Notes: - Destructive: overwrites destination cells.
Inputs: file_path (required), sheet_name (required), target_cell (required), source_range (required), +2 more.
unpivot_dataA
Melt (unpivot) wide-form data to long-form using id_vars and value_vars.
Args: file_path: Workbook path. sheet_name: Source sheet. id_vars: Columns to keep as identifiers. value_vars: Columns to melt into variable/value pairs. var_name: Name for the variable column. value_name: Name for the value column.
Returns: dict: Result summary and destination range if written.
Inputs: id_vars (required), file_path (required), sheet_name (required), value_vars (required), +2 more.
upload_fileA
Upload a file for server-side processing.
Accepts a base64-encoded file string or an HTTP/HTTPS URL. Returns a session_id and file_path that can be used with any other tool. The file is stored temporarily on the server and auto-deleted after 1 hour or when release_file is called.
Args: file_content: Base64-encoded file bytes OR an HTTP/HTTPS URL pointing to the file. filename: Filename hint used to determine the file extension (e.g. "data.xlsx", "report.csv").
Returns: dict: A mapping containing: - session_id (str): Opaque ID for this file session. - file_path (str): Server-side local path — use this as file_path in other tools. - message (str): Human-readable confirmation.
Inputs: file_content (required), filename.
value_countsARead-only
Return frequency counts for a column as counts or normalized proportions.
Args: file_path: Workbook path. sheet_name: Worksheet name. column: Column name to analyse. normalize: If True return proportions instead of raw counts. top_n: If provided, return only the top N values. dropna: Exclude nulls when True. has_header: Whether the sheet has a header row.
Returns: dict: {"column", "total_rows", "normalize", "counts": [{"value", "count"}, ...]}.
Inputs: column (required), file_path (required), sheet_name (required), top_n, +3 more.
vlookup_helperARead-only
Perform cross-file lookup akin to VLOOKUP with optional fuzzy matching.
Args:
lookup_file: Workbook containing keys to look up.
data_file: Workbook containing reference data.
lookup_column: Column in lookup_file to match.
data_key_column: Column in data_file to join on.
data_return_columns: Columns from data_file to return.
lookup_sheet, data_sheet: Sheet names.
fuzzy: If True, perform fuzzy matching.
fuzzy_threshold: Threshold for fuzzy confidence.
output_file: Optional path to write augmented lookup results.
header_row: 1-based header row index.
Returns: dict: Mapping rows to matched results and match scores.
Notes:
- Read-only on inputs unless output_file is provided.
Inputs: data_file (required), lookup_file (required), lookup_column (required), data_key_column (required), +7 more.
worksheet_printB
Configure print areas, page setup, print titles and manual page breaks.
Args: action: "set_print_area", "set_page_setup", "set_print_titles", "add_page_break", "remove_page_break". file_path, sheet_name: Workbook and worksheet. print_area, orientation, paper_size, fit_to_width, fit_to_height, title_rows, title_cols, row, col: params.
Returns: str: Result message.
Notes: - Mostly metadata changes to the sheet's print settings.
Inputs: action (required), file_path (required), sheet_name (required), col, +8 more. Returns: result
worksheet_structureBDestructive
Perform row/column insert/delete, grouping, and size adjustments.
Args: action: One of insert/delete/group/ungroup/set_row_height/set_col_width. file_path: Workbook path. sheet_name: Worksheet name. row, col, count, start_row, end_row, start_col, end_col: Position arguments. outline_level, hidden, rows, cols_list, height, width: Operation-specific params.
Returns: str: Result message.
Notes: - Many actions are destructive (delete_rows/delete_cols) — document irreversible effects.
Inputs: action (required), file_path (required), sheet_name (required), col, +12 more. Returns: result
worksheet_transferB
Cross-sheet and cross-workbook copy/merge/stack operations.
Args: action: "copy_range_across", "copy_sheet_across", "merge_workbooks", or "stack_sheets". file_path: Source workbook path (varies by action). source_sheet, source_range: Source identifiers for copy. target_sheet, target_start_cell: Destination identifiers. copy_values, copy_styles: Copy options. source_file, dest_file, dest_sheet_name: For copy_sheet_across. source_files, output_file, conflict_strategy: For merge_workbooks. sheet_names, dest_sheet, include_header, output_path: For stack_sheets.
Returns: str or dict: Result metadata.
Notes: - These operations can be expensive (many file opens) and destructive. Document conflict resolution strategies.
Inputs: action (required), dest_file, file_path, dest_sheet, +14 more. Returns: result
worksheet_viewA
Toggle view-related settings such as freeze panes, auto-filter and gridlines.
Args: action: "freeze", "auto_filter", or "set_gridlines". file_path: Workbook path. sheet_name: Worksheet name. cell_ref: For freeze, the pane freeze cell (omit to unfreeze). cell_range: For auto_filter set/remove. remove: For auto_filter, remove filter when True. show: For set_gridlines, show/hide gridlines.
Returns: str: Result message.
Notes: - Usually non-destructive aside from toggling UI settings stored in workbook.
Inputs: action (required), file_path (required), sheet_name (required), show, +3 more. Returns: result
write_cellsA
Write data or operations to worksheet cells.
Args:
mode: One of "single", "range", "series", "merge", or "unmerge".
- "single": write a single cell. Requires cell_ref and value.
- "range": write a 2D array starting at start_cell. Requires start_cell and data.
- "series": fill a series from start_cell. Requires start_cell and count.
- "merge": merge a cell range. Requires range_string.
- "unmerge": unmerge a cell range. Requires range_string.
file_path: Path to workbook to mutate.
sheet_name: Target worksheet name.
cell_ref: Single-cell reference for "single" and some formula operations.
value: Value to write for single-cell writes.
start_cell: Top-left cell for range/series writes.
data: 2D array of values for "range" mode.
series_type: Series type for "series" (e.g. "number").
count: Number of series entries to write (required for "series").
step: Increment for numeric series or string step expression.
direction: "down" or "right" for series growth.
start_value: Optional starting value for series.
range_string: Range string for merge/unmerge (e.g. "A1:D1").
Returns: str or dict: Success message or structured result depending on operation.
Raises:
ValueError: If required parameters for the chosen mode are missing or mode is unknown.
Notes:
- This route mutates workbook files (destructive operations).
- Dispatch mapping: "single"→tools.cell_ops.write_cell, "range"→tools.cell_ops.write_range,
"series"→tools.cell_ops.fill_series, "merge"→tools.cell_ops.merge_cells, "unmerge"→tools.cell_ops.unmerge_cells.
- Recommend adding short examples in the underlying tools for common series patterns.
Inputs: mode (required), file_path (required), sheet_name (required), data, +9 more. Returns: result
write_multi_sheetA
Create or overwrite a workbook with multiple sheets, headers and data in a single call.
Args: file_path: Destination workbook path. sheets: List of SheetDefinition (name, headers, rows, column widths, etc.).
Returns: WriteMultiSheetResult: Result model with file path and any warnings.
Notes: - Destructive when targeting existing files — document overwrite semantics in higher-level docs.
Inputs: sheets (required), file_path (required). Returns: file_path, sheets_created
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 69 tools
Many tools have distinct purposes, but there is notable overlap between related operations (e.g., copy_range vs. worksheet_transfer, vlookup_helper vs. merge_datasets, find_duplicates vs. deduplicate_data). Additionally, several tools use an 'action' parameter to bundle multiple sub-operations, which increases ambiguity and the chance of misselection despite clear descriptions.
All names are snake_case and mostly readable, but conventions vary between verb-first (create_workbook, read_cells) and noun-first (column_statistics, data_cleaner). Some names are acronym-heavy or irregular (csv_ops, vlookup_helper, dcf_analysis), and a few are compound verbs (find_replace) or noun phrases (worksheet_structure). The lack of a clear consistent pattern makes naming moderately inconsistent.
With 69 tools, the server offers an extensive surface area. Even for a rich domain like Excel, this exceeds the 'well-scoped' range by a large margin and may overwhelm agents. The complexity is not inherently bad, but it is significantly above the recommended 3-15 tools, making it heavy to navigate and maintain.
The tool set is remarkably comprehensive, covering workbook lifecycle, cell operations, formatting, formulas, charts, worksheet management, data manipulation, statistical analysis, financial calculations, file import/export, and file lifecycle (upload/download/release). It provides a full range of operations from basic read/write to advanced analytics, with no major gaps evident for typical Excel tasks.
Maintenance
Related MCP Connectors
File tools for your AI chat: PDF tables to Excel, merge PDFs, images to PDF, fill PDF forms.
Open, inspect, filter, edit and convert xlsx and csv files from your AI chat. Processing is local.
Open, inspect, filter, edit and convert xlsx and csv files from your AI chat. Processing is local.
The Excel engine for AI agents: read, check and edit Excel models over MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to create, read, and manipulate Excel files without requiring Microsoft Excel installation. Supports comprehensive spreadsheet operations including formulas, formatting, charts, pivot tables, and data validation.MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to create, read, and modify Excel workbooks without requiring Microsoft Excel, supporting operations like formulas, charts, pivot tables, formatting, and data validation.MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to create, read, and manipulate Excel workbooks without Microsoft Excel installed, supporting formulas, formatting, charts, pivot tables, and data validation operations.MIT
- AlicenseNot gradedqualityDmaintenanceEnables manipulation of Excel files including creating, reading, writing data, formatting, charts, pivot tables, and worksheet management via natural language.12 npmMIT