Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
sbroenne avatar

Excel Cli

  • 859 installs
  • 416 repo stars
  • Updated August 4, 2026
  • sbroenne/mcp-server-excel

excel-cli is a Claude Code skill that teaches coding agents to automate Microsoft Excel workbooks on Windows through excelcli commands for ranges, PivotTables, Power Query, DAX, charts, VBA, and formatting without brittl

About

excel-cli is a Windows Excel automation skill built around the excelcli command-line tool and COM interop against Microsoft Excel 2016 or newer. It guides agents through token-efficient, scriptable workbook reads, writes, formatting, batch edits, Power Query, DAX, PivotTables, tables, ranges, charts, VBA touches, data models, and screenshots for unattended jobs. The skill targets CI/CD pipelines, scheduled tasks, PowerShell workflows, and bulk workbook processing where Python COM snippets burn tokens and break easily. Developers reach for excel-cli when a coding agent must reliably manipulate xlsx assets on a Windows host instead of reimplementing Excel logic in open-source parsers alone.

  • 10+ excelcli commands covering sessions, worksheets, ranges, PivotTables, charts, VBA, screenshots and formatting
  • Batch mode with `excelcli -q batch --input commands.json` for single-process multi-command execution
  • JSON 2D array `--values` syntax for reliable row-by-row data writing
  • Automatic session management and Power Query / DAX / Data Model support
  • Hard-gate workflow: always start with session create/open and end with session close --save

Excel Cli by the numbers

  • 859 all-time installs (skills.sh)
  • +6 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #323 of 2,715 Automation & Workflows skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/sbroenne/mcp-server-excel --skill excel-cli

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs859
repo stars416
Security audit1 / 3 scanners passed
Last updatedAugust 4, 2026
Repositorysbroenne/mcp-server-excel

How do you automate Excel workbooks from the command line?

Let their coding agent read, write, format, and process Excel workbooks through reliable CLI commands without wasting tokens on brittle Python COM scripts.

Who is it for?

Windows developers automating Excel 2016+ workbooks in CI/CD, scheduled jobs, or PowerShell pipelines who need COM-accurate workbook edits via excelcli.

Skip if: macOS or Linux-only environments without Microsoft Excel installed that require cross-platform xlsx parsing instead of live Excel automation.

When should I use this skill?

User mentions excelcli, Excel CLI, COM automation, PowerShell workbook batch, PivotTables, DAX, or unattended Excel CI jobs on Windows.

What you get

excelcli command sequences for workbook edits, PivotTables, Power Query, DAX, charts, formatting, and unattended batch outputs.

  • excelcli command scripts
  • Batch workbook edit workflows
  • Formatted report outputs

Files

SKILL.mdMarkdownGitHub ↗

Excel Automation with excelcli

Preconditions

  • Windows host with Microsoft Excel installed (2016+)
  • Uses COM interop — does NOT work on macOS or Linux
  • GitHub Copilot excel-cli plugin auto-downloads the latest Windows runtime on first use
  • Direct skill-only installs require excelcli.exe on PATH

Workflow Checklist

StepCommandWhen
1. Sessionsession create/openAlways first
2. Sheetsworksheet create/renameIf needed
3. Write dataSee belowIf writing values
4. Save & closesession close --saveAlways last
10+ commands? Use excelcli -q batch --input commands.json — sends all commands in one process with automatic session management. See Rule 8.

Writing Data (Step 3):

  • --values takes a JSON 2D array string: --values '[["Header1","Header2"],[1,2]]'
  • Write one row at a time for reliability: --range-address A1:B1 --values '[["Name","Age"]]'
  • Strings MUST be double-quoted in JSON: "text". Numbers are bare: 42
  • Always wrap the entire JSON value in single quotes to protect special characters

CRITICAL RULES (MUST FOLLOW)

⚡ Building dashboards or bulk operations? Skip to Rule 8: Batch Mode — it eliminates per-command process overhead and auto-manages session IDs.

Rule 1: NEVER Ask Clarifying Questions

Execute commands to discover the answer instead:

DON'T ASKDO THIS INSTEAD
"Which file should I use?"excelcli -q session list
"What table should I use?"excelcli -q table list --session <id>
"Which sheet has the data?"excelcli -q worksheet list --session <id>

You have commands to answer your own questions. USE THEM.

Rule 2: Always End With a Text Summary

NEVER end your turn with only a command execution. After completing all operations, always provide a brief text message confirming what was done. Silent command-only responses are incomplete.

Rule 3: Session Lifecycle

Creating vs Opening Files:

# NEW file - use session create
excelcli -q session create C:\path\newfile.xlsx  # Creates file + returns session ID

# EXISTING file - use session open
excelcli -q session open C:\path\existing.xlsx   # Opens file + returns session ID

CRITICAL: Use `session create` for new files. `session open` on non-existent files will fail!

CRITICAL: ALWAYS use the session ID returned by `session create` or `session open` in subsequent commands. NEVER guess or hardcode session IDs. The session ID is in the JSON output (e.g., `{"sessionId":"abc123"}`). Parse it and use it.

# Example: capture session ID from output, then use it
excelcli -q session create C:\path\file.xlsx     # Returns JSON with sessionId
excelcli -q range set-values --session <returned-session-id> ...
excelcli -q session close --session <returned-session-id> --save

Unclosed sessions leave Excel processes running, locking files.

Rule 4: Data Model Prerequisites

DAX operations require tables in the Data Model:

excelcli -q table add-to-data-model --session <id> --table-name Sales  # Step 1
excelcli -q datamodel create-measure --session <id> ...               # Step 2 - NOW works

Rule 5: Power Query Development Lifecycle

BEST PRACTICE: Test M code before creating permanent queries

# Step 1: Create/open a session and capture the session ID
$session = excelcli -q session create C:\path\file.xlsx | ConvertFrom-Json
$sessionId = $session.sessionId

# Step 2: Test M code without persisting (catches errors early)
excelcli -q powerquery evaluate --session $sessionId --m-code-file query.m

# Step 3: Create permanent query with validated code
excelcli -q powerquery create --session $sessionId --query-name Q1 --m-code-file query.m

# Step 4: Load data to destination
excelcli -q powerquery refresh --session $sessionId --query-name Q1

# Step 5: Close session
excelcli -q session close --session $sessionId --save

Rule 6: Report File Errors Immediately

If you see "File not found" or "Path not found" - STOP and report to user. Don't retry.

Rule 7: Use Calculation Mode for Bulk Writes

When writing many values/formulas (10+ cells), disable auto-recalc for performance:

# 1. Create/open a session and capture the session ID
$session = excelcli -q session create C:\path\file.xlsx | ConvertFrom-Json
$sessionId = $session.sessionId

# 2. Set manual mode
excelcli -q calculationmode set-mode --session $sessionId --mode manual

# 3. Write data row by row for reliability
excelcli -q range set-values --session $sessionId --sheet-name Sheet1 --range-address A1:B1 --values '[["Name","Amount"]]'
excelcli -q range set-values --session $sessionId --sheet-name Sheet1 --range-address A2:B2 --values '[["Salary",5000]]'

# 4. Recalculate once at end
excelcli -q calculationmode calculate --session $sessionId --scope workbook

# 5. Restore automatic mode
excelcli -q calculationmode set-mode --session $sessionId --mode automatic

# 6. Close session
excelcli -q session close --session $sessionId --save

Rule 8: Use Batch Mode for Bulk Operations (10+ commands)

When executing 10+ commands on the same file, use excelcli batch to send all commands in a single process launch. This avoids per-process startup overhead and terminal buffer saturation.

# Create a JSON file with all commands
@'
[
  {"command": "session.open", "args": {"filePath": "C:\\path\\file.xlsx"}},
  {"command": "range.set-values", "args": {"sheetName": "Sheet1", "rangeAddress": "A1", "values": [["Hello"]]}},
  {"command": "range.set-values", "args": {"sheetName": "Sheet1", "rangeAddress": "A2", "values": [["World"]]}},
  {"command": "session.close", "args": {"save": true}}
]
'@ | Set-Content commands.json

# Execute all commands at once
excelcli -q batch --input commands.json

Key features:

  • Session auto-capture: session.open/create result sessionId auto-injected into subsequent commands — no need to parse and pass session IDs
  • NDJSON output: One JSON result per line: {"index": 0, "command": "...", "success": true, "result": {...}}
  • `--stop-on-error`: Exit on first failure (default: continue all)
  • `--session <id>`: Pre-set session ID for all commands (skip session.open)

Input formats:

  • JSON array from file: excelcli -q batch --input commands.json
  • NDJSON from stdin: Get-Content commands.ndjson | excelcli -q batch

CLI Command Reference

Full reference: See CLI command reference and common pitfalls, or run excelcli <command> --help for live help from the installed runtime.

Syntax rule: CLI commands use excelcli -q <command> <action> --session <id> --kebab-case-flags .... Do not use MCP call syntax such as range(action: ...), snake_case parameters, or underscore tool names. The CLI command names remove MCP underscores: calculation_mode becomes calculationmode, range_format becomes rangeformat, chart_config becomes chartconfig, and data_model becomes datamodel.

Available command groups:

session, batch, service, calculationmode, chart, chartconfig, conditionalformat, connection, datamodel, datamodelrelationship, diag, namedrange, pivottable, pivottablecalc, pivottablefield, powerquery, range, rangeedit, rangeformat, rangelink, screenshot, sheet, worksheetstyle, slicer, table, tablecolumn, vba, window

Common Pitfalls

See CLI command reference and common pitfalls for examples. Key issues:

  • --values-file expects a path to an existing file; use --values for inline JSON.
  • --timeout must be a positive integer; omit it to use the default timeout.
  • --values takes a 2D JSON array such as '[["Name","Age"],["Alice",30]]'.
  • List parameters such as --selected-items require JSON arrays.
  • Power Query operations can take 30+ seconds; use generous timeouts.

Reference Documentation

  • CLI command reference and common pitfalls

Related skills

How it compares

Pick excel-cli when you need live Excel COM features on Windows rather than cross-platform xlsx read/write libraries alone.

FAQ

What does excel-cli require on the host machine?

excel-cli requires a Windows host with Microsoft Excel 2016 or newer installed because excelcli drives workbooks through COM interop. The skill is designed for scriptable, unattended automation rather than manual spreadsheet editing sessions.

Which Excel features does excel-cli cover?

excel-cli covers excelcli automation for ranges, tables, formatting, charts, PivotTables, Power Query, DAX, data models, VBA interactions, and screenshots. It fits CI/CD, PowerShell workflows, and bulk workbook processing where command-line repeatability matters.

Is Excel Cli safe to install?

skills.sh reports 1 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.