Loading...
Loading...
Automate Microsoft Excel on Windows via CLI. Use when creating, reading, or modifying Excel workbooks from scripts, CI/CD, or coding agents. Supports Power Query, DAX, PivotTables, Tables, Ranges, Charts, VBA. Triggers: Excel, spreadsheet, workbook, xlsx, excelcli, CLI automation.
npx skill4agent add sbroenne/mcp-server-excel excel-cli| DON'T ASK | DO THIS INSTEAD |
|---|---|
| "Which file should I use?" | |
| "What table should I use?" | |
| "Which sheet has the data?" | |
# CORRECT - Use --values-file
$data = '[["Name","Price"],["Widget",100]]'
$data | Out-File -Encoding UTF8 C:\temp\data.json
excelcli -q range set-values --session 1 --sheet Sheet1 --range A1 --values-file C:\temp\data.json
# CORRECT - Use --mcode-file for Power Query
$mcode | Out-File -Encoding UTF8 C:\temp\query.m
excelcli -q powerquery create --session 1 --query Products --mcode-file C:\temp\query.mexcelcli -q session open C:\path\file.xlsx # Returns session ID
excelcli -q range set-values --session 1 ... # Use session ID
excelcli -q session close --session 1 --save # Save and releaseexcelcli -q table add-to-datamodel --session 1 --table Sales # Step 1
excelcli -q datamodel create-measure --session 1 ... # Step 2 - NOW works# Step 1: Test M code without persisting (catches errors early)
excelcli -q powerquery evaluate --session 1 --mcode-file query.m
# Step 2: Create permanent query with validated code
excelcli -q powerquery create --session 1 --query Q1 --mcode-file query.m
# Step 3: Load data to destination
excelcli -q powerquery refresh --session 1 --query Q1# 1. Set manual mode
excelcli -q calculationmode set-mode --session 1 --mode manual
# 2. Perform bulk writes
excelcli -q range set-values --session 1 --sheet Sheet1 --range A1 --values-file data.json
# 3. Recalculate once at end
excelcli -q calculationmode calculate --session 1 --scope workbook
# 4. Restore automatic mode
excelcli -q calculationmode set-mode --session 1 --mode automatic| Task | Command |
|---|---|
| Open workbook | |
| List sheets | |
| Read data | |
| Create table | |
| Add to Data Model | |
| Create pivot | |
| Save & close | |
excelcli <command> --helpdotnet tool install --global Sbroenne.ExcelMcp.CLI