PluginBench
Skill
Review
Audit score 70

excel-mcp

sbroenne/mcp-server-excel

Windows Excel automation via MCP—326 operations for workbooks, Power Query, DAX, PivotTables, and charts.

What is excel-mcp?

Excel MCP Server provides rich Model Context Protocol tools for creating, inspecting, modifying, and analyzing Excel files on Windows. Use it when you need to automate workbook operations including data entry, formatting, Power Query (M), Data Model/DAX measures, PivotTables, charts, slicers, VBA, and calculation control.

  • Open, create, and save Excel workbooks with session management
  • Write, read, and format cell ranges with number formats (currency, dates, percentages)
  • Convert data ranges to Excel Tables with structured references
  • Create and manage PivotTables from ranges or Data Model tables
  • Build Power Query (M) queries with evaluate-first validation workflow
  • Define DAX measures and manage the Data Model

How to install excel-mcp

npx skills add https://github.com/sbroenne/mcp-server-excel --skill excel-mcp
Prerequisites
  • Windows operating system
  • Microsoft Excel 2016 or later installed
  • Network access for first-run runtime download
  • Full Windows file paths (e.g., C:\Users\Name\Documents\Report.xlsx)
  • Excel files must not be open in another Excel instance during automation
Claude Code
Cursor
Windsurf
Cline

How to use excel-mcp

  1. 1.Install the skill: npx skills add https://github.com/sbroenne/mcp-server-excel --skill excel-mcp
  2. 2.Open or create a workbook using file(action: 'open', path: '...') and capture the session_id
  3. 3.List existing sheets, tables, and queries to discover structure using worksheet(list), table(list), powerquery(list)
  4. 4.Write data using range(action: 'set-values', ...) with 2D arrays, then apply formats with range(action: 'set-number-format', ...)
  5. 5.Convert data ranges to tables using table(action: 'create', ...) for structured references and Data Model compatibility
  6. 6.Create PivotTables, charts, or Power Query queries as needed, using evaluate-first for Power Query validation
  7. 7.Close the workbook with file(action: 'close', session_id: sessionId, save: true) to persist changes and release the Excel process

Use cases

Good for
  • Bulk data import and formatting: write 10,000 rows with currency formatting and auto-fit columns
  • Dashboard automation: create PivotTables and charts from live data, add slicers for filtering
  • Power Query ETL: evaluate M code to validate transformations before persisting queries
  • DAX reporting: build Data Model measures and create PivotTables from calculated fields
  • Workbook templates: programmatically populate templates with formatted data and formulas
Who it's for
  • Data analysts automating report generation
  • Business intelligence developers building dashboards
  • Financial analysts creating formatted workbooks and what-if models
  • Developers integrating Excel into larger automation pipelines
  • Anyone needing Windows-based Excel file manipulation via code

excel-mcp FAQ

Do I need to ask which file or table to use?

No. Use file(list) to discover open sessions, worksheet(list) to find sheets, and table(list) to find tables. The skill provides tools to answer your own questions—use them instead of asking.

Why do my formatted numbers show ##### instead of values?

The column is too narrow for the formatted value. After setting number formats, always call range_format(action: 'auto-fit-columns', ...) to resize columns to fit the rendered output.

Should I use manual calculation mode for all writes?

Only when writing many values or formulas in bulk. Use manual mode to disable auto-recalc during writes, then call calculate(scope: 'workbook') once, then restore automatic mode. For small writes or reads, automatic mode is fine.

How do I create a DAX measure?

First, create a table and add it to the Data Model using table(action: 'add-to-data-model', ...). Then use datamodel(action: 'create-measure', ...) to define the DAX formula. The table must exist in the Data Model before the measure can reference it.

What's the best way to test Power Query code before saving it?

Use powerquery(action: 'evaluate', m_code: '...') first to test syntax and see a data preview. This catches errors without polluting the workbook. Once validated, use powerquery(action: 'create', ...) to persist the query.

Full instructions (SKILL.md)

Source of truth, from sbroenne/mcp-server-excel.


name: excel-mcp description: > Excel MCP Server skill for Windows workbook automation. Use when an assistant needs rich MCP tools to create, inspect, modify, format, or analyze Excel files. Supports Power Query (M), Data Model/DAX, PivotTables, Tables, Ranges, Charts, Slicers, formatting, screenshots, VBA macros, connections, and calculation mode. Triggers: Excel, spreadsheet, workbook, xlsx, xlsm, Power Query, DAX, PivotTable, chart, dashboard, VBA, MCP. compatibility: Requires Windows, Microsoft Excel 2016 or later, and network access for first-run runtime download.

Excel MCP Server Skill

Provides 326 Excel operations via Model Context Protocol. The MCP Server hosts the ExcelMCP Service in-process and calls it directly for low-latency Excel automation. Tools are auto-discovered - this documents quirks, workflows, and gotchas.

Workflow Checklist

StepToolActionWhen
1. Open filefileopen or createAlways first
2. Create sheetsworksheetcreate, renameIf needed
3. Write datarangeset-valuesAlways (2D arrays)
4. Formatrangeset-number-formatAfter writing
5. StructuretablecreateConvert data to tables
6. Save & closefileclose with save: trueAlways last

Preconditions

  • Windows host with Microsoft Excel installed (2016+)
  • Use full Windows paths: C:\Users\Name\Documents\Report.xlsx
  • Excel files must not be open in another Excel instance

Calculation Mode Workflow (Batch Performance)

Use calculation_mode for bulk write performance optimization. When writing many values or formulas, disable auto-recalc to avoid recalculating after every cell:

1. calculation_mode(action: 'set-mode', mode: 'manual')  → Disable auto-recalc
2. Perform all writes (range set-values, set-formulas)
3. calculation_mode(action: 'calculate', scope: 'workbook')  → Recalculate once
4. calculation_mode(action: 'set-mode', mode: 'automatic')  → Restore default

Note: You do NOT need manual mode to read formulas - range get-formulas returns formula text regardless of calculation mode.

CRITICAL: Execution Rules (MUST FOLLOW)

Rule 1: NEVER Ask Clarifying Questions

STOP. If you're about to ask "Which file?", "What table?", "Where should I put this?" - DON'T.

Bad (Asking)Good (Discovering)
"Which Excel file should I use?"file(list) → use the open session
"What's the table name?"table(list) → discover tables
"Which sheet has the data?"worksheet(list) → check all sheets
"Should I create a PivotTable?"YES - create it on a new sheet

You have tools to answer your own questions. USE THEM.

Rule 2: Always End With a Text Summary

NEVER end your turn with only a tool call. After completing all operations, always provide a brief text message confirming what was done. Silent tool-call-only responses are incomplete.

Rule 3: Format Data Professionally

Always apply number formats after setting values:

Data TypeFormat CodeResult
USD$#,##0.00$1,234.56
EUR€#,##0.00€1,234.56
Percent0.00%15.00%
Date (ISO)yyyy-mm-dd2025-01-22

Write format codes in US notation (, grouping, . decimal) regardless of the machine's locale — Excel translates them. The rendered separators follow the user's Windows regional settings, so $#,##0.00 shows $1.234,56 on a German system. Don't "fix" that by swapping the separators in the format code; it would break on every other locale.

Workflow:

1. range set-values (data is now in cells)
2. range set-number-format (apply format)
3. range_format auto-fit-columns (formatted values are wider than raw ones)

Step 3 is not optional. A column sized for 45678 is too narrow once that value renders as 2025-01-22 or $1,234.56, and Excel displays ##### instead of the number.

Rule 4: Use Excel Tables (Not Plain Ranges)

Always convert tabular data to Excel Tables:

1. range set-values (write data including headers)
2. table(action: 'create', table_name: 'SalesData', range_address: 'A1:D100')

Why: Structured references, auto-expand, required for Data Model/DAX.

Rule 5: Session Lifecycle

1. file(action: 'open', path: '...')  → capture response.session_id as sessionId
2. workbook(action: 'get-info', session_id: sessionId)
3. file(action: 'close', session_id: sessionId, save: true)  → saves and closes

Pass that same value as session_id on every session-based follow-up call. sessionId above is a local variable, not an MCP argument name. When reusing a session from file(list), copy the matching entry's sessionId value into session_id. Never guess or substitute a session.

Unclosed sessions leave Excel processes running, locking files.

Rule 6: Data Model Prerequisites

DAX operations require tables in the Data Model:

Step 1: Create table → Table exists
Step 2: table(action: 'add-to-data-model') → Table in Data Model
Step 3: datamodel(action: 'create-measure') → NOW this works

Rule 7: Power Query Development Lifecycle

BEST PRACTICE: Test-First Workflow

1. powerquery(action: 'evaluate', m_code: '...') → Test WITHOUT persisting
2. powerquery(action: 'create', ...) → Store validated query
3. powerquery(action: 'refresh', ...) → Load data

Why evaluate first:

  • Catches syntax errors and missing sources BEFORE creating permanent queries
  • Better error messages than COM exceptions from create/update
  • See actual data preview (columns + sample rows)
  • No cleanup needed - like a REPL for M code
  • Skip only for trivial literal tables

Common mistake: Creating/updating without evaluate → pollutes workbook with broken queries

Rule 8: Targeted Updates Over Delete-Rebuild

  • Prefer: set-values on specific range (e.g., A5:C5 for row 5)
  • Avoid: Deleting and recreating entire structures

Why: Preserves formatting, formulas, and references.

Rule 9: Follow suggestedNextActions

Error responses include actionable hints:

{
  "success": false,
  "errorMessage": "Table 'Sales' not found in Data Model",
  "suggestedNextActions": ["table(action: 'add-to-data-model', table_name: 'Sales')"]
}

Tool Selection Quick Reference

TaskToolKey Action
Create/open/save workbooksfileopen, create, close
Write/read cell datarangeset-values, get-values
Format cellsrangeset-number-format
Create tables from datatablecreate
Add table to Power Pivottableadd-to-data-model
Create DAX formulasdatamodelcreate-measure
Create PivotTablespivottablecreate, create-from-datamodel
Filter with slicersslicerset-slicer-selection
Create chartschartcreate-from-range
Run what-if analysisanalysisgoal-seek, create-scenario, create-data-table
Control calculation modecalculation_modeget-mode, set-mode, calculate
Visual verificationscreenshotcapture, capture-sheet

Reference Documentation

See references/ for detailed guidance: