ExcelMcp - MCP Server for Microsoft Excel
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 (22 tools with 194 operations).
🛡️ 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.
🧪 LLM-Tested Quality - Tool behavior validated with real AI agents using agent-benchmark. We test that LLMs correctly understand and use our tools.
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.
🚀 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
The extension opens automatically after installation with a quick start guide!
For Claude Desktop (One-Click Install)
Download the .mcpb file from the latest release and double-click to install.
For Visual Studio, Cursor, Windsurf, or other MCP clients:
📖 Complete Installation Guide → - 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
22 specialized tools with 194 operations:
- 🔄 Power Query (1 tool, 10 ops) - Atomic workflows, M code management, load destinations
- 📊 Data Model/DAX (2 tools, 18 ops) - Measures with auto-formatted DAX, relationships, model structure
- 🎨 Excel Tables (2 tools, 27 ops) - Lifecycle, filtering, sorting, structured references
- 📈 PivotTables (3 tools, 30 ops) - Creation, fields, aggregations, calculated members/fields
- 📉 Charts (2 tools, 14 ops) - Create, configure, manage series and formatting
- 📝 VBA (1 tool, 6 ops) - Modules, execution, version control
- 📋 Ranges (4 tools, 42 ops) - Values, formulas, formatting, validation, protection
- 📄 Worksheets (2 tools, 16 ops) - Lifecycle, colors, visibility, cross-workbook moves
- 🔌 Connections (1 tool, 9 ops) - OLEDB/ODBC management and refresh
- 🏷️ Named Ranges (1 tool, 6 ops) - Parameters and configuration
- 📁 Files (1 tool, 6 ops) - Session management and workbook creation
- �️ Slicers (1 tool, 8 ops) - Interactive filtering for PivotTables and Tables
- �🎨 Conditional Formatting (1 tool, 2 ops) - Rules and clearing
📚 Complete Feature Reference → - Detailed documentation of all 194 operations
💬 Example Prompts
Create & Populate Data:
- "Create a new Excel file called SalesTracker.xlsx with a table for Date, Product, Quantity, Unit Price, and Total with sample data"
- "Put this data in A1:C4 - Name, Age, City / Alice, 30, Seattle / Bob, 25, Portland"
- "Add a formula column that calculates Quantity times Unit Price"
Analysis & Visualization:
- "Create a PivotTable from this data showing total sales by Product, then add a bar chart"
- "Use Power Query to import products.csv, load it to the Data Model, and create a measure for Total Revenue"
- "Create a slicer for the Region field so I can filter the PivotTable interactively"
- "Create a relationship between the Orders and Products tables using ProductID"
Formatting & Styling:
- "Format the Price column as currency and highlight values over $500 in green"
- "Convert this range to an Excel Table with a blue style and add a totals row"
- "Make the headers bold with a dark background and auto-fit column widths"
Automation:
- "Export all Power Query M code to files for version control"
- "Run the UpdatePrices macro"
- "Show me Excel while you work" - watch changes in real-time
👥 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 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 → - Detailed tool documentation and examples
Project Information
License: MIT License - see LICENSE file
Privacy: See PRIVACY.md for our privacy policy
Contributing: See 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
