Files
sbroenne__mcp-server-excel/vscode-extension
Stefan Broenner 0eb11c04e9 Remove redundant QueryTable and ListExcelSources features (#197)
* Update README to streamline API safety section and enhance clarity

* Update robots.txt to enhance sitemap visibility and prioritize crawling for Googlebot and Bingbot

* Remove obsolete PowerQuery integration tests for LoadTo and timeout scenarios

* Refactor using directives across multiple command files for consistency

* Remove redundant ListExcelSources and Unload methods (#133)

Removed ListExcelSources method from PowerQuery commands as it duplicates
functionality already available via separate excel_table(list) and
excel_namedrange(list) tool calls. LLMs can easily chain these operations.

Also removed Unload method as the interface signature was removed during
earlier refactoring but enum/tool routing remained.

**Changes:**
- Removed IPowerQueryCommands.ListExcelSources() interface method
- Removed PowerQueryCommands.ListExcelSources() implementation (~95 lines)
- Removed PowerQueryAction.ListExcelSources enum value
- Removed action mapping for 'list-excel-sources' from ActionExtensions
- Removed MCP Server tool routing for ListExcelSources (~15 lines)
- Removed PowerQueryAction.Unload enum value
- Removed action mapping for 'unload' from ActionExtensions
- Removed MCP Server tool routing for Unload (~20 lines)
- Converted 10 PowerQuery tests to inline M code (removed .pq file dependencies)

**Total cleanup:** ~140 lines removed

**Related to #133:** Code cleanup discovered both bugs already fixed:
- Bug #1 (Column Preservation): Tests pass - Update handles column changes
- Bug #2 (ListObject Accumulation): Delete() removes ListObjects properly
- All regression tests passing (2/2)

* Remove redundant QueryTable functionality

QueryTable functionality duplicates existing Power Query + Table + Connection
tool capabilities. LLMs can compose workflows from existing tools without
needing a separate QueryTable abstraction.

**Redundancy Analysis:**
- CreateFromQuery → excel_powerquery(action: 'create', loadDestination: 'worksheet')
- CreateFromConnection → excel_connection(action: 'loadto')
- List → excel_table(list) + excel_powerquery(list)
- Refresh → excel_powerquery(refresh) or excel_connection(refresh)
- Delete → excel_powerquery(delete) or excel_table(delete)
- UpdateProperties → Rarely needed, can be set during creation

**Files Deleted:**
- src/ExcelMcp.Core/Commands/QueryTable/ directory (IQueryTableCommands.cs, QueryTableCommands.cs, QueryTableCommands.Lifecycle.cs)
- src/ExcelMcp.Core/Models/QueryTableTypes.cs
- src/ExcelMcp.CLI/Commands/QueryTable/ directory
- src/ExcelMcp.McpServer/Tools/ExcelQueryTableTool.cs
- tests/ExcelMcp.Core.Tests/Integration/Commands/QueryTable/ directory (4 test files)
- src/ExcelMcp.McpServer/Prompts/Content/excel_querytable.md
- specs/QUERYTABLE-SUPPORT-SPECIFICATION.md

**Code Changes:**
- Removed QueryTableAction enum from ToolActions.cs
- Removed ToActionString mapping from ActionExtensions.cs
- Removed CLI command registrations from Program.cs
- Updated tool count: 12 → 11 in all README files
- Updated action count: 163 → 155 in all README files

**Total cleanup:** ~800 lines removed (Core: ~400, CLI: ~150, MCP: ~100, Tests: ~150)

**Same rationale as ListExcelSources removal:** LLMs don't need convenience
wrappers - they can chain operations from focused, single-purpose tools.

* Update documentation to remove QueryTable references

- GitHub Pages: Update tool count (12→11) and action count (163→155)
- Copilot instructions: Remove QueryTable from architecture patterns
- MCP prompts: Remove QueryTable guidance from tool selection, user patterns, server quirks
- MCP prompts: Update excel_connection and excel_powerquery to remove QueryTable references
- Specs: Remove QueryTableTool from session redesign tracking
- ComInterop: Remove unused FindQueryTable() helper (~70 lines)
- Delete ExcelQueryTablePrompts.cs (no longer needed)
- VS Code extension: Update dev dependencies (TypeScript types, eslint)
2025-11-18 17:58:43 +00:00
..
2025-11-17 09:27:59 +00:00

Excel MCP Server - AI-Powered Excel Automation

GitHub License: MIT

Control Microsoft Excel with AI through GitHub Copilot - just ask in natural language!

Instead of clicking through Excel menus, simply ask:

Data Transformation & Analysis:

  • "Optimize all my Power Queries in this workbook for better performance"
  • "Create a PivotTable from SalesData table showing top 10 products by region"
  • "Build a DAX measure calculating year-over-year growth with proper time intelligence"

Formatting & Styling (No Programming Required):

  • "Format revenue columns as currency, make headers bold with blue background"
  • "Apply conditional formatting to highlight values above $10,000 in red"
  • "Convert this range to an Excel Table with filters and totals row"

Workflow Automation:

  • "Find all cells containing 'Q1 2024' and replace with 'Q1 2025'"
  • "Add data validation dropdowns to Status column with options: Active, Pending, Completed"

🛡️ 100% Safe - Uses Excel's Native API

Unlike third-party libraries that manipulate .xlsx files directly (risking file corruption), Excel MCP Server 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 as you work with live Excel files
  • ✅ Comprehensive automation - Currently supports 163 operations across 12 specialized tools

Quick Example:

You: "Create a Power Query named 'SalesData' that loads from data.csv"

Copilot uses Excel MCP Server to:
1. Create/open an Excel workbook
2. Add the Power Query with proper M code
3. Load the data to a worksheet
4. Save and return confirmation

Result: A working Excel file with the query ready to use

👥 Who Should Use This?

Perfect for:

  • ✅ Data analysts automating repetitive Excel workflows
  • ✅ Developers building Excel-based data solutions
  • ✅ Business users managing complex Excel workbooks
  • ✅ Teams maintaining Power Query/VBA/DAX code in Git

Not suitable for:

  • ❌ Linux/macOS users (Windows + Excel installation required)
  • ❌ High-volume batch operations (consider Excel-free alternatives)

Quick Start

  1. Install this extension (you just did!)
  2. Ask Copilot in the chat panel:
    • "List all Power Query queries in workbook.xlsx"
    • "Create a DAX measure for year-over-year revenue growth"
    • "Export all VBA modules to .vba files for version control"

That's it! The extension automatically installs .NET 8 runtime and includes a bundled MCP server.

➡️ Learn more and see examples

Requirements

  • Windows OS - Excel COM automation requires Windows
  • Microsoft Excel 2016+ - Must be installed on your system
  • .NET 8 Runtime - Automatically installed by the extension

What's Included

Features

The Excel MCP Server provides 12 specialized tools for comprehensive Excel automation:

Tool Operations Purpose
excel_powerquery 11 actions Power Query M code: create, view, update, delete, load configuration, list sources
excel_datamodel 14 actions Power Pivot (Data Model): DAX measures, relationships, discover structure (tables, columns), refresh
excel_table 26 actions Excel Tables: lifecycle, columns, filters, sorts, structured references, number formatting
excel_pivottable 20 actions PivotTables: create, field management, aggregations, filters, sorting, extract data
excel_range 43 actions Ranges: get/set values/formulas, formatting, validation, clear, copy, insert/delete, find/replace, merge, cell protection
excel_conditionalformat 2 actions Conditional Formatting: add rules (cell value, expression-based), clear rules
excel_vba 7 actions VBA: list, view, export, import, update, run, delete modules
excel_connection 9 actions Connections: OLEDB/ODBC/Text/Web management, properties, refresh, test
excel_worksheet 13 actions Worksheets: lifecycle, tab colors, visibility (list, create, rename, copy, delete, show/hide, very-hide)
excel_namedrange 7 actions Named ranges: list, get, set, create, delete, update, bulk create
excel_file 6 actions File operations: create empty, open, save, close, close-workbook, test
Total 155 actions

Troubleshooting

"Excel is not installed" error:

  • Ensure Microsoft Excel 2016+ is installed on your Windows machine
  • Try opening Excel manually to verify it works

"VBA access denied" error:

  • VBA operations require one-time manual setup in Excel
  • Go to: File → Options → Trust Center → Trust Center Settings → Macro Settings
  • Check "Trust access to the VBA project object model"

Copilot doesn't see Excel tools:

  • Restart VS Code after installing the extension

  • Troubleshooting

  • Check Output panel → "Excel MCP Server" for connection status

Documentation & Support

License

MIT License - see LICENSE


Built with GitHub Copilot | Powered by Model Context Protocol