🤔 What is This?
Stop manually clicking through Excel menus for repetitive tasks. Instead, describe what you want in plain English and let the coding agent and the MCP Server handle the task:
- “Load this sales data CSV file into Excel. Only keep the columns that I need to compare sales numbers month over month. Load them to a data model and create the necessary DAX measures. Add pivot tables.
- “Create a PivotTable from SalesData table showing top 10 products by region with sum and average”
- “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”
- “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”
- “Extract all PowerQueries, DAX measures and VBA code so I can use version control in GIT”.
The AI assistant analyzes your request, generates the proper Excel automation commands, and executes them directly in your Excel application - no formulas or programming knowledge required.
🚀 Visual Studio Code Quick Start (1 Minute)
One-click setup with GitHub Copilot integration
Install from Marketplace
What is This Project?
ExcelMcp is a comprehensive Excel automation toolkit with two interfaces:
- MCP Server: Enables AI assistants (GitHub Copilot, Claude, ChatGPT) to automate Excel through natural language commands
- CLI Tool: Provides direct command-line control for scripting, RPA, and CI/CD workflows
Both share the same core functionality: automate Power Query, DAX measures, VBA macros, PivotTables, formatting, and data transformations. Choose MCP for AI-powered conversations or CLI for programmatic control.
🛡️ 100% Safe - Uses Excel’s Native COM API
Unlike third-party libraries that manipulate .xlsx files directly (risking file corruption), ExcelMcp uses Excel’s official COM API. This ensures:
- âś… Zero risk of document corruption - Excel handles all file operations safely
- ✅ Interactive development - See changes in real-time, create → test → refine → iterate instantly
- âś… Comprehensive automation - Currently supports 164 operations across 12 specialized tools covering Power Query, Data Model/DAX, VBA, PivotTables, Excel Tables, ranges, conditional formatting, and more
đź’» For Developers: Think of Excel as an AI-powered REPL - write code (Power Query M, DAX, VBA), execute instantly, inspect results visually in the live workbook. No more blind editing of .xlsx files.
Key Features
156 Operations
11 specialized tools covering Power Query, DAX, VBA, PivotTables, ranges, conditional formatting, and more
100% Safe
Uses Excel's native COM API - zero corruption risk, full compatibility
Interactive Development
See changes in real-time - create, test, refine, and iterate instantly. Use Excel as a REPL.
Natural Language Control
Describe what you want, AI does the rest
Comprehensive Automation
155 operations covering Power Query, DAX, VBA, Tables, and more
Dual Interface
Choose MCP for AI assistants or CLI for scripts and RPA
Use Cases
- Optimize Power Query M code for performance
- Create PivotTables from data with natural language
- Build DAX measures with AI guidance
- Transform and clean data automatically
👉 See examples of Power Query and DAX automation
- Format columns as currency, dates, percentages
- Apply conditional formatting with color rules
- Create Excel Tables with auto-filters
- Add data validation dropdowns
👉 See examples of formatting automation
Workflow Automation
- Find and replace across ranges
- Sort and filter data programmatically
- Merge cells and auto-fit columns
- Manage Powerquery M Code, DAX statements and VBA macros with version control
Installation
MCP Server
For Claude, ChatGPT, and other MCP clients
dotnet tool install -g Sbroenne.ExcelMcp.McpServer
CLI Tool
For scripting, RPA, and CI/CD workflows
dotnet tool install -g Sbroenne.ExcelMcp.CLI
đź“– Complete Installation Guide
Documentation
Examples
AI Assistant Examples (MCP Server)
🔍 Optimize Power Query
You: "This Power Query is taking 5 minutes to refresh. Can you optimize it?"
AI analyzes your M code, identifies inefficiencies, and applies best practices automatically.
📊 Create PivotTable
You: "Create a PivotTable from SalesData showing top 10 products by region"
AI creates the PivotTable with proper field configuration in seconds.
🎨 Format Data
You: "Format revenue as currency, make headers bold blue, and add borders"
AI applies all formatting directly to your Excel file.
CLI Examples (Scripting & RPA)
Automate Power Query Refresh
# Refresh all queries in a workbook (CI/CD pipeline)
excel-mcp pq-refresh --file "sales-report.xlsx" --query "SalesData"
Batch Update Worksheets
# Process multiple workbooks in PowerShell
Get-ChildItem *.xlsx | ForEach-Object {
excel-mcp sheet-create --file $_.Name --name "Summary"
excel-mcp range-set-values --file $_.Name --sheet "Summary" --range "A1" --values "[[\"Generated: $(Get-Date)\"]]"
}
Export VBA for Version Control
# Export all VBA modules to Git repository
excel-mcp vba-export --file "macro-workbook.xlsm" --module "Module1" --output "src/vba/Module1.bas"
Why Choose This Project?
🤖 MCP Server (AI-Powered)
- Natural Language Control: Describe tasks in plain English
- Safe: Official COM API - zero corruption risk
- Interactive: See changes in real-time in Excel
- Comprehensive: 155 operations across 11 tools
- Works with: GitHub Copilot, Claude, ChatGPT, and any MCP client
⚙️ CLI (Automation & Scripting)
- RPA Ready: Perfect for robotic process automation workflows
- CI/CD Integration: Automate Excel operations in build pipelines
- Scripting: PowerShell, Bash, Python integration
- Batch Processing: Process multiple workbooks programmatically
- No AI Required: Direct command-line control for scripts
Both Share the Same Core
Same 155 operations available via CLI and MCP. Consistent behavior across interfaces. Full .NET library available for custom integrations.
Keywords
Excel automation, MCP server, Model Context Protocol, GitHub Copilot, Claude AI, Power Query, M language, DAX, Power Pivot, VBA macros, Excel Tables, PivotTables, data analysis, spreadsheet automation, RPA, robotic process automation, COM automation, Windows automation, AI Excel assistant, natural language Excel, Excel API, Excel COM interop, Excel CLI, command line Excel, Excel scripting, Excel batch processing, CI/CD Excel, DevOps Excel, Excel PowerShell, Excel automation tool, .NET Excel library, Excel NuGet package