Excel MCP Server

Excel MCP Server Icon

Excel MCP Server

AI-Powered Excel Automation

Control Microsoft Excel with Natural Language through AI assistants like GitHub Copilot and Claude. One-click install for Visual Studio Code.

VS Code Marketplace Installs GitHub Stars GitHub Downloads NuGet MCP Server Installs

πŸ€” What is This?

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 173 operations.

πŸš€ Visual Studio Code Quick Start (1 Minute)

One-click setup with GitHub Copilot integration

Install from Marketplace

Key Features

173 Operations

12 specialized tools with 173 operations covering Power Query, DAX, Charts, VBA, PivotTables, ranges, conditional formatting, and more

Complete Feature Reference β†’

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.

πŸ’‘ Tip: Say "Show me Excel while you work" to watch changes live!

Natural Language Control

Describe what you want, AI does the rest

Comprehensive Automation

173 operations covering Power Query, DAX, Charts, VBA, Tables, and more

Dual Interface

Choose MCP for AI assistants or CLI for scripts and RPA

Installation

VS Code Extension Recommended

One-click setup with GitHub Copilot integration

Install from Marketplace

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: 173 operations across 12 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 173 operations available via CLI and MCP. Consistent behavior across interfaces.

Complete Tool & Action Reference

12 specialized tools with 173 operations:

πŸ“Š Power Query & M Code (9 actions)

Action Description
list List all Power Query queries in workbook
view View M code for a specific query
create Create new Power Query from M code
update Update existing query’s M code
delete Delete a Power Query
refresh Refresh a specific query to reload data
refresh-all Refresh all queries in workbook
get-load-config Get load destination settings for a query
load-to Load query data to worksheet, data model, or both

πŸ”’ Power Pivot / Data Model (15 actions)

Action Description
list-tables List all tables in Data Model
read-table Read data from a Data Model table
list-columns List all columns in a table
list-measures List all DAX measures in a table
read Read details of a specific measure
create-measure Create new DAX measure
update-measure Update existing DAX measure formula or format
delete-measure Delete a DAX measure
list-relationships List all table relationships
read-relationship Read details of a specific relationship
create-relationship Create relationship between tables
update-relationship Update relationship properties
delete-relationship Delete a relationship
read-info Get Data Model metadata and statistics
refresh Refresh entire Data Model

πŸ“‹ Excel Tables (24 actions)

Action Description
list List all Excel Tables in workbook
read Read table data and properties
create Create new Excel Table from range
rename Rename an Excel Table
delete Delete an Excel Table
resize Resize table range
set-style Apply table style (TableStyleMedium2, etc.)
toggle-totals Show/hide totals row
set-column-total Set aggregation function for column total
append Append rows to table
get-data Return table data (optionally respecting active filters)
add-to-datamodel Add table to Power Pivot Data Model
apply-filter Apply filter criteria to column
apply-filter-values Filter by specific values
clear-filters Clear all filters
get-filters Get current filter settings
add-column Add new column to table
remove-column Remove column from table
rename-column Rename table column
get-structured-reference Get structured reference formula
sort Sort table by column
sort-multi Sort by multiple columns
get-column-number-format Get number format for column
set-column-number-format Set number format for column

πŸ“ˆ PivotTables (25 actions)

Action Description
list List all PivotTables in workbook
read Read PivotTable configuration
create-from-range Create PivotTable from range
create-from-table Create PivotTable from Excel Table
create-from-datamodel Create PivotTable from Data Model
delete Delete a PivotTable
refresh Refresh PivotTable data
list-fields List all available fields
add-row-field Add field to Rows area
add-column-field Add field to Columns area
add-value-field Add field to Values area with aggregation
add-filter-field Add field to Filters area
remove-field Remove field from PivotTable
set-field-function Set aggregation function (Sum, Count, Average, etc.)
set-field-name Set custom field display name
set-field-format Set number format for value field
set-field-filter Apply filter to a field
sort-field Sort field values
get-data Extract PivotTable data as values
set-grand-totals Configure grand totals display
set-column-grand-totals Show/hide column grand totals
set-row-grand-totals Show/hide row grand totals
get-grand-totals Get grand totals configuration
set-subtotals Configure subtotals for fields
get-subtotals Get subtotals configuration

πŸ“Š Charts (14 actions)

Action Description
list List all charts in the workbook
read Read chart metadata and data source information
create-from-range Create chart from a worksheet range
create-from-pivottable Create PivotChart from a PivotTable
delete Delete a chart
move Move and resize chart on the sheet
set-source-range Update chart source range
add-series Add a new data series to the chart
remove-series Remove a data series by index
set-chart-type Change chart type (Column, Line, Pie, etc.)
set-title Set chart title text
set-axis-title Set title for primary or secondary axes
show-legend Show/hide legend and set legend position
set-style Apply built-in chart style (1-48)

πŸ“ Ranges & Data (42 actions)

Action Description
get-values Read cell values from range
set-values Write values to range
get-formulas Read formulas from range
set-formulas Write formulas to range
get-number-formats Get number formats for range
set-number-format Set number format (currency, percentage, date, etc.)
set-number-formats Set multiple number formats at once
clear-all Clear values, formulas, and formatting
clear-contents Clear values and formulas only
clear-formats Clear formatting only
copy Copy range (all attributes)
copy-values Copy values only
copy-formulas Copy formulas only
insert-cells Insert cells with shift direction
delete-cells Delete cells with shift direction
insert-rows Insert rows
delete-rows Delete rows
insert-columns Insert columns
delete-columns Delete columns
find Find cells matching criteria
replace Find and replace in range
sort Sort range by columns
get-used-range Get actual used range in worksheet
get-current-region Get contiguous range around cell
get-info Get range metadata (address, size, etc.)
add-hyperlink Add hyperlink to cell
remove-hyperlink Remove hyperlink from cell
list-hyperlinks List all hyperlinks in range
get-hyperlink Get hyperlink details
get-style Get cell style name
set-style Apply built-in Excel style
format-range Apply visual formatting (font, fill, border, alignment)
validate-range Add data validation rules (dropdowns, number/date/text rules)
get-validation Get validation settings
remove-validation Remove data validation
autofit-columns Auto-fit column widths
autofit-rows Auto-fit row heights
merge-cells Merge cells in range
unmerge-cells Unmerge cells
get-merge-info Get merge status and areas
set-cell-lock Lock/unlock cells for protection
get-cell-lock Get cell lock status

🎨 Conditional Formatting (2 actions)

Action Description
add-rule Add conditional formatting rule (cell value or expression-based)
clear-rules Clear conditional formatting from range

πŸ–₯️ VBA Macros (6 actions)

Action Description
list List all VBA modules in workbook
view View VBA module code
import Import VBA code from file
delete Delete VBA module
run Execute VBA macro
update Update existing VBA module code

πŸ”Œ Data Connections (9 actions)

Action Description
list List all data connections
view View connection details and settings
create Create new data connection (OLEDB, ODBC, Text, Web)
test Test connection validity
refresh Refresh connection to reload data
delete Delete a connection
load-to Load connection data to worksheet
get-properties Get connection properties
set-properties Update connection properties

πŸ“„ Worksheets (16 actions)

Action Description
list List all worksheets in workbook
create Create new worksheet
rename Rename worksheet
copy Copy worksheet within same workbook
delete Delete worksheet
move Move worksheet to different position
copy-to-file Copy worksheet to different file (atomic, no session needed)
move-to-file Move worksheet to different file (atomic, no session needed)
set-tab-color Set worksheet tab color (RGB)
get-tab-color Get current tab color
clear-tab-color Remove tab color
hide Hide worksheet from UI (visible in VBA)
very-hide Hide from UI and VBA
show Make worksheet visible
get-visibility Get current visibility state
set-visibility Set visibility state

🏷️ Named Ranges (6 actions)

Action Description
list List all named ranges
read Read named range value
write Write value to named range
create Create new named range
update Update named range reference
delete Delete named range

πŸ“ File Operations (5 actions)

Action Description
open Open workbook session
close Close workbook session without saving
create-empty Create new empty workbook (.xlsx or .xlsm)
close-workbook Close workbook and optionally save changes
test Test if workbook can be opened

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