# ExcelMcp - MCP Server for Microsoft Excel
[](https://github.com/sbroenne/mcp-server-excel/actions/workflows/build-mcp-server.yml)
[](https://github.com/sbroenne/mcp-server-excel/actions/workflows/build-cli.yml)
[](https://github.com/sbroenne/mcp-server-excel/releases/latest)
[](https://github.com/sbroenne/mcp-server-excel/releases)
[](https://www.nuget.org/packages/Sbroenne.ExcelMcp.McpServer)
[](https://www.nuget.org/packages/Sbroenne.ExcelMcp.McpServer)
[](https://www.nuget.org/packages/Sbroenne.ExcelMcp.CLI)
[](https://opensource.org/licenses/MIT)
[](https://dotnet.microsoft.com/download/dotnet/8.0)
[](https://github.com/sbroenne/mcp-server-excel)
[](https://copilot.github.com/)
**Automate Excel with AI - A Model Context Protocol (MCP) server for comprehensive Excel automation through conversational AI.**
**MCP Server for Excel** enables AI assistants (GitHub Copilot, Claude, ChatGPT) to automate Excel through natural language commands. Automate Power Query, DAX measures, VBA macros, PivotTables, Charts, formatting, and data transformations - no Excel programming knowledge required.
**π‘οΈ 100% Safe - Uses Excel's Native COM API** - Zero risk of file corruption. Unlike third-party libraries that manipulate `.xlsx` files directly, this project uses Excel's official API ensuring complete safety and compatibility.
**π‘ Interactive Development** - See results instantly in Excel. Create a query, run it, inspect the output, refine and repeat. Excel becomes your AI-powered workspace for rapid development and testing.
**Optional CLI Tool:** For advanced users who prefer command-line scripting, ExcelMcp includes a CLI interface for RPA workflows, CI/CD pipelines, and batch automation. Both interfaces share the same 172 operations.
## π Quick Start (1 Minute)
**Requirements:** Windows OS + Microsoft Excel 2016+
### β Recommended: VS Code Extension (One-Click Setup)
**Fastest way to get started - everything configured automatically: [Install from Marketplace](https://marketplace.visualstudio.com/items?itemName=sbroenne.excel-mcp)**
The extension opens automatically after installation with a quick start guide!
### For Visual Studio, Claude Desktop, Cursor, Windsurf, or other MCP clients:
π **[Complete Installation Guide β](docs/INSTALLATION.md)** - Step-by-step setup for all AI assistants with ready-to-use config files
**β οΈ Important:** Close all Excel files before using ExcelMcp. The server requires **exclusive access** to workbooks during automation (Excel COM limitation).
## π― What You Can Do
**12 specialized tools with 172 operations:**
- π **Power Query** (9 ops) - Atomic workflows, M code management, load destinations
- π **Data Model/DAX** (14 ops) - Measures, relationships, model structure
- π¨ **Excel Tables** (24 ops) - Lifecycle, filtering, sorting, structured references
- π **PivotTables** (25 ops) - Creation, fields, aggregations, data extraction
- π **Charts** (14 ops) - Create, configure, manage series and formatting
- π **VBA** (6 ops) - Modules, execution, version control
- π **Ranges** (42 ops) - Values, formulas, formatting, validation, protection
- π **Worksheets** (16 ops) - Lifecycle, colors, visibility, cross-workbook moves
- π **Connections** (9 ops) - OLEDB/ODBC management and refresh
- π·οΈ **Named Ranges** (6 ops) - Parameters and configuration
- π **Files** (5 ops) - Session management and workbook creation
- π¨ **Conditional Formatting** (2 ops) - Rules and clearing
π **[Complete Feature Reference β](FEATURES.md)** - Detailed documentation of all 172 operations
## π¬ Example Prompts
**Data Transformation & Analysis:**
- *"Optimize all my Power Queries in this workbook for better performance"*
- *"Create a PivotTable from SalesData table showing top 10 products by region with sum and average"*
- *"Create a data model from the following tables ... "*
- *"Build a DAX measure calculating year-over-year growth with proper time intelligence"*
- *"Filter this table by Column Product = Sushi"*
- *"Create a treemap chart from this table".
**Formatting & Styling (No Programming Required):**
- *"Format the revenue columns as currency, make headers bold with blue background, and add borders to the table"*
- *"Apply conditional formatting to highlight values above $10,000 in red and below $5,000 in yellow"*
- *"Convert this data range to an Excel Table with style TableStyleMedium2, add auto-filters, and create a totals row"*
**Workflow Automation:**
- *"Find all cells containing 'Q1 2024' and replace with 'Q1 2025', then sort the table by Date descending"*
- *"Add data validation dropdowns to the Status column with options: Active, Pending, Completed"*
- *"Merge the header cells, center-align them, and auto-fit all column widths to content"*
## π₯ Who Should Use This?
**Perfect for:**
- β
**Data analysts** automating repetitive Excel workflows
- β
**Developers** building Excel-based data solutions
- β
**Business users** managing complex Excel workbooks
- β
**Teams** maintaining Power Query/VBA/DAX code in Git
**Not suitable for:**
- β Server-side data processing (use libraries like ClosedXML, EPPlus instead)
- β Linux/macOS users (Windows + Excel installation required)
- β High-volume batch operations (consider Excel-free alternatives)
## π Additional Information
### CLI for Direct Automation
xcelMcp includes a CLI interface for Excel automation without AI assistance. This is useful for RPA workflows, CI/CD pipelines, or batch processing scripts. Run `excelcli --help` for a categorized list of commands, or `excelcli sheet --help` (replace `sheet`) to view action-specific options. **Always follow the session pattern:** `excelcli session open <file>` β run commands with `--session <id>` β `excelcli session save/close <id>`. See **[CLI Guide](src/ExcelMcp.CLI/README.md)** for complete documentation.
## π§ How It Works - COM Interop Architecture
**ExcelMcp uses Windows COM automation to control the actual Excel application (not just .xlsx files).**
This means you get:
- β
**Full Excel Feature Access** - Power Query engine, VBA runtime, Data Model, calculation engine, pivot tables
- β
**True Compatibility** - Works exactly like Excel UI, no feature limitations
- β
**Live Data Operations** - Refresh Power Query, connections, Data Model in real workbooks
- β
**Interactive Development** - Immediate Excel feedback as AI makes changes
- β
**All File Formats** - .xlsx, .xlsm, .xlsb, even legacy formats
**π‘ Tip: Watch Excel While AI Works**
By default, Excel runs hidden for faster automation. To see changes in real-time, just ask:
- *"Show me Excel while you work"*
- *"Let me watch what you're doing"*
- *"Open Excel so I can see the changes"*
The AI will display the Excel window so you can watch every operation happen live - great for learning or verifying changes!
**Technical Requirements:**
- β οΈ **Windows Only** - COM interop is Windows-specific
- β οΈ **Excel Required** - Microsoft Excel 2016 or later must be installed
- β οΈ **Desktop Environment** - Controls actual Excel process (not for server-side processing)
> π **[Complete MCP Server Guide β](src/ExcelMcp.McpServer/README.md)** - Detailed tool documentation and examples
## Project Information
**License:** MIT License - see [LICENSE](LICENSE) file
**Contributing:** See [CONTRIBUTING.md](docs/CONTRIBUTING.md) for guidelines
**Built With:** This entire project was developed using GitHub Copilot AI assistance - mainly with Claude but lately with Auto-mode.
**Acknowledgments:**
- Microsoft Excel Team - For comprehensive COM automation APIs
- Model Context Protocol community - For the AI integration standard
- Open Source Community - For inspiration and best practices
### SEO & Discovery
`Excel Automation` β’ `Automate Excel with AI` β’ `MCP Server` β’ `Model Context Protocol` β’ `GitHub Copilot Excel` β’ `AI Excel Assistant` β’ `Power Query Automation` β’ `Power Query M Code` β’ `Power Pivot Automation` β’ `DAX Measures` β’ `DAX Automation` β’ `Data Model Automation` β’ `PivotTable Automation` β’ `VBA Automation` β’ `Excel Tables Automation` β’ `Excel AI Integration` β’ `COM Interop` β’ `Windows Excel Automation` β’ `Excel Development Tools` β’ `Excel Productivity` β’ `Excel Scripting` β’ `Conversational Excel` β’ `Natural Language Excel`
# test