excel-cli

sbroenne/mcp-server-excel · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/sbroenne/mcp-server-excel --skill excel-cli
0 commentsdiscussion
summary

Automate Microsoft Excel on Windows via CLI with 50+ commands for workbooks, tables, charts, and Power Pivot.

  • Windows-only tool using COM interop; requires Excel 2016+ installed; install via dotnet tool install --global Sbroenne.ExcelMcp.CLI
  • Supports 10+ command categories: worksheets, ranges, tables, charts, PivotTables, Power Query, Data Model/DAX, VBA, and conditional formatting
  • Batch mode processes 10+ commands in a single session with auto-captured session IDs, eliminating per-c
skill.md

Excel Automation with excelcli

Preconditions

Workflow Checklist

Step Command When
1. Session session create/open Always first
2. Sheets worksheet create/rename If needed
3. Write data See below If writing values
4. Save & close session close --save Always 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 ASK DO 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

Auto-generated from excelcli --help. Use these exact parameter names.

calculationmode

Control Excel recalculation (automatic vs manual). Set manual mode before bulk writes for faster performance, then recalculate once at the end.

Actions: get-mode, set-mode, calculate

Parameter Description
--mode Target calculation mode (required for: set-mode)
--scope Scope: Workbook, Sheet, or Range (required for: calculate)
--sheet-name Sheet name (required for Sheet/Range scope)
--range-address Range address (required for Range scope)

chart

Chart lifecycle - create, read, move, and delete embedded charts. POSITIONING (choose one): - targetRange (PREFERRED): Cell range like 'F2:K15' — positions chart within cells, no point math needed. - left/top: Manual positioning in points (72 points = 1 inch). - Neither: Auto-positions chart below all existing content (used range + other charts). COLLISION DETECTION: All create/move/fit-to-range operations automatically check for overlaps with data and other charts. Warnings are returned in the result message if collisions are detected. Always verify layout with screenshot(capture-sheet) after creating charts. CHART TYPES: 70+ types available including Column, Line, Pie, Bar, Area, XY Scatter. CREATE OPTIONS: - create-from-range: Create from cell range (e.g., 'A1:D10') - create-from-table: Create from Excel Table (uses table's data range) - create-from-pivottable: Create linked PivotChart Use chartconfig for series, titles, legends, styles, placement mode.

Actions: list, read, create-from-range, create-from-table, create-from-pivottable, delete, move, fit-to-range

Parameter Description
--chart-name Name of the chart (or shape name) (required for: read, delete, move, fit-to-range)
--sheet-name Target worksheet name (required for: create-from-range, create-from-table, create-from-pivottable, fit-to-range)
--source-range-address Data range for the chart (e.g., A1:D10) (required for: create-from-range)
--chart-type Type of chart to create (required for: create-from-range, create-from-table, create-from-pivottable)
--left Left position in points from worksheet edge
--top Top position in points from worksheet edge
--width Chart width in points
--height Chart height in points
--target-range Cell range to position chart within (e.g., 'F2:K15'). PREFERRED over left/top. When set, left/top are ignored.
--table-name Name of the Excel Table (required for: create-from-table)
--pivot-table-name Name of the source PivotTable (required for: create-from-pivottable)
--range-address Range to fit the chart to (e.g., A1:D10) (required for: fit-to-range)

chartconfig

Chart configuration - data source, series, type, title, axis labels, legend, and styling. SERIES MANAGEMENT: - add-series: Add data series with valuesRange (required) and optional categoryRange - remove-series: Remove series by 1-based index - set-source-range: Replace entire chart data source TITLES AND LABELS: - set-title: Set chart title (empty string hides title) - set-axis-title: Set axis labels (Category, Value, CategorySecondary, ValueSecondary) CHART STYLES: 1-48 (built-in Excel styles with different color schemes) DATA LABELS: Show values, percentages, series/category names. Positions: Center, InsideEnd, InsideBase, OutsideEnd, BestFit. TRENDLINES: Linear, Exponential, Logarithmic, Polynomial (order 2-6), Power, MovingAverage. PLACEMENT MODE: - 1: Move and size with cells - 2: Move but don't size with cells - 3: Don't move or size with cells (free floating) Use chart for lifecycle operations (create, delete, move, fit-to-range).

Actions: set-source-range, add-series, remove-series, set-chart-type, set-title, set-axis-title, get-axis-number-format, set-axis-number-format, show-legend, set-style, set-placement, set-data-labels, get-axis-scale, set-axis-scale, get-gridlines, set-gridlines, set-series-format, list-trendlines, add-trendline, delete-trendline, set-trendline

how to use excel-cli

How to use excel-cli on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add excel-cli
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/sbroenne/mcp-server-excel --skill excel-cli

The skills CLI fetches excel-cli from GitHub repository sbroenne/mcp-server-excel and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/excel-cli

Reload or restart Cursor to activate excel-cli. Access the skill through slash commands (e.g., /excel-cli) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

User Story & Requirements Generation

Create detailed user stories, acceptance criteria, and feature specs

Example

Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios

Reduce spec writing time by 50%, ensure comprehensive coverage

Competitive Analysis

Research competitors, compare features, identify gaps

Example

Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities

Complete competitive research in 2 hours instead of 2 days

Roadmap Prioritization

Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs

Example

Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale

Make data-driven prioritization decisions faster

Stakeholder Communication

Draft PRDs, status updates, and stakeholder presentations

Example

Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement

Save 3-5 hours/week on communication overhead

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client
  • Access to product documentation and roadmap tools (Jira, Notion, etc.)
  • Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
  • Stakeholder contact information and communication channels

Time Estimate

30-60 minutes to see productivity improvements

Installation Steps

  1. 1.Install product management skill
  2. 2.Start with user story generation for known feature
  3. 3.Progress to competitive analysis: research 2-3 competitors
  4. 4.Use for roadmap prioritization: apply RICE/ICE scoring
  5. 5.Draft stakeholder communications and refine based on feedback
  6. 6.Build template library for recurring PM tasks
  7. 7.Share effective prompts with product team

Common Pitfalls

  • Not validating competitive research—verify facts before sharing
  • Accepting user stories without involving engineering team
  • Over-relying on frameworks without qualitative judgment
  • Not customizing outputs to company culture and communication style
  • Skipping stakeholder validation of generated requirements

Best Practices

✓ Do

  • +Validate research and competitive analysis with real data
  • +Collaborate with engineering when generating technical requirements
  • +Customize frameworks and templates to your company context
  • +Use skill for first drafts, refine with stakeholder input
  • +Document successful prompt patterns for PM tasks
  • +Combine AI efficiency with human judgment and intuition

✗ Don't

  • Don't publish competitive analysis without fact-checking
  • Don't finalize user stories without engineering review
  • Don't make prioritization decisions solely on AI scoring
  • Don't skip customer validation of generated requirements
  • Don't ignore company-specific context and culture

💡 Pro Tips

  • Provide context: company goals, constraints, customer feedback
  • Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
  • Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
  • Use skill for 70% generation + 30% customization to company needs

When to Use This

✓ Use When

Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.

✗ Avoid When

Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.

Learning Path

  1. 1Basic: user stories, feature specs, status updates
  2. 2Intermediate: competitive analysis, prioritization frameworks, PRDs
  3. 3Advanced: product strategy, go-to-market planning, OKR setting
  4. 4Expert: product vision, market positioning, business model innovation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.675 reviews
  • Ganesh Mohane· Dec 28, 2024

    Registry listing for excel-cli matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Aarav Zhang· Dec 28, 2024

    I recommend excel-cli for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Shikha Mishra· Dec 24, 2024

    excel-cli is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Min Kim· Dec 12, 2024

    excel-cli fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Meera Martinez· Dec 12, 2024

    excel-cli reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Maya Rao· Dec 8, 2024

    We added excel-cli from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Mateo Martinez· Dec 4, 2024

    Solid pick for teams standardizing on skills: excel-cli is focused, and the summary matches what you get after install.

  • Maya Smith· Dec 4, 2024

    excel-cli is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Aarav Patel· Nov 27, 2024

    Keeps context tight: excel-cli is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Daniel Jain· Nov 23, 2024

    excel-cli has been reliable in day-to-day use. Documentation quality is above average for community skills.

showing 1-10 of 75

1 / 8
Parameter Description
--chart-name Name of the chart (required)
--source-range New data source range (e.g., Sheet1!A1:D10) (required for: set-source-range)
--series-name Display name for the series (required for: add-series)
--values-range Range containing series values (e.g., B2:B10) (required for: add-series)
--category-range Optional range for category labels (e.g., A2:A10)
--series-index 1-based index of the series to remove (required for: remove-series, set-series-format, list-trendlines, add-trendline, delete-trendline, set-trendline)
--chart-type New chart type to apply (required for: set-chart-type)
--title Title text to display (required for: set-title, set-axis-title)
--axis Which axis to set title for (Category, Value, SeriesAxis) (required for: set-axis-title, get-axis-number-format, set-axis-number-format, get-axis-scale, set-axis-scale, set-gridlines)
--number-format Excel number format code (e.g., "$#,##0", "0.00%") (required for: set-axis-number-format)
--visible True to show legend, false to hide (required for: show-legend)
--legend-position Optional position for the legend
--style-id Excel chart style ID (1-48 for most chart types) (required for: set-style)
--placement Placement mode: 1=MoveAndSize, 2=Move, 3=FreeFloating (required for: set-placement)
--show-value Show data values on labels
--show-percentage Show percentage values. Only meaningful for pie and doughnut chart types; setting to true on other chart types has no visual effect.
--show-series-name Show series name on labels
--show-category-name Show category name on labels
--show-bubble-size Show bubble size (bubble charts)
--separator Separator string between label components
--label-position Position of data labels relative to data points
--minimum-scale Minimum axis value (null for auto)
--maximum-scale Maximum axis value (null for auto)
--major-unit Major gridline interval (null for auto)
--minor-unit Minor gridline interval (null for auto)
--show-major Show major gridlines (null to keep current)
--show-minor Show minor gridlines (null to keep current)
--marker-style Marker shape style
--marker-size Marker size in points (2-72)
--marker-background-color Marker fill color (#RRGGBB)
--marker-foreground-color Marker border color (#RRGGBB)
--invert-if-negative Invert colors for negative values
--trendline-type Type of trendline (Linear, Exponential, etc.) (required for: add-trendline)