productivitydeveloper-tools

xlwings Excel

hyunjae-labs

by hyunjae-labs

xlwings Excel: Manipulate Excel files without installing Excel. 30+ tools for workbooks, data ops, formatting, formulas,

Enables Excel file manipulation without Microsoft Excel installation through xlwings library, providing 30+ tools for workbook creation, data operations, formatting, formulas, charts, pivot tables, and worksheet management across Windows and cross-platform environments.

github stars

5

0 commentsdiscussion

Both formats append explainx.ai attribution and the canonical URL for this MCP server listing.

Works without Excel installation30+ Excel automation toolsSession-based architecture for performance

best for

  • / Automating Excel report generation
  • / Data analysts processing spreadsheets programmatically
  • / Backend systems generating Excel exports
  • / Cross-platform Excel file manipulation

capabilities

  • / Create and open Excel workbooks
  • / Read and write cell data with formulas
  • / Format cells and apply conditional formatting
  • / Generate charts and pivot tables
  • / Manage worksheets and ranges
  • / Create Excel tables with styling

what it does

Creates and manipulates Excel files without needing Microsoft Excel installed, using the xlwings library with 30+ automation tools.

about

xlwings Excel is a community-built MCP server published by hyunjae-labs that provides AI assistants with tools and capabilities via the Model Context Protocol. xlwings Excel: Manipulate Excel files without installing Excel. 30+ tools for workbooks, data ops, formatting, formulas, It is categorized under productivity, developer tools.

how to install

You can install xlwings Excel in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.

license

NOASSERTION

xlwings Excel is released under the NOASSERTION license.

readme

xlwings-mcp-server

Version Python License MCP

A robust Model Context Protocol (MCP) server for Excel automation using xlwings. This server provides comprehensive Excel file manipulation capabilities through a session-based architecture, designed for high-performance and reliable Excel operations.

🚀 Features

Core Capabilities

  • Session-based Architecture: Persistent Excel workbook sessions for optimal performance
  • Comprehensive Excel Operations: Full support for data manipulation, formulas, formatting, and visualization
  • Thread-safe Operations: Concurrent access with per-session locking
  • Automatic Resource Management: TTL-based session cleanup and LRU eviction policies
  • Zero-Error Design: Katherine Johnson principle compliance with comprehensive error handling

Excel Operations

  • Workbook Management: Open, create, list, and close Excel workbooks
  • Worksheet Operations: Create, copy, rename, and delete worksheets
  • Data Manipulation: Read, write, and modify Excel data with full type support
  • Formula Support: Apply and validate Excel formulas with syntax checking
  • Advanced Formatting: Cell styling, conditional formatting, and range formatting
  • Visualization: Chart creation with multiple chart types
  • Table Operations: Native Excel table creation and management
  • Range Operations: Cell merging, copying, and deletion

🛠️ Installation

Prerequisites

  • Python 3.10 or higher
  • Windows OS (required for xlwings COM integration)
  • Microsoft Excel installed

Using pip

pip install xlwings-mcp-server

From Source

git clone https://github.com/yourusername/xlwings-mcp-server.git
cd xlwings-mcp-server
pip install -e .

Using uv (Recommended)

uv add xlwings-mcp-server

⚡ Quick Start

1. Basic Usage

Start the MCP server:

xlwings-mcp-server

Or run directly:

python -m xlwings_mcp

2. Session-based Workflow

# Example using MCP client
import mcp

# Open a workbook session
session_result = client.call_tool("mcp__xlwings-mcp-server__open_workbook", {
    "filepath": "C:/path/to/your/file.xlsx",
    "visible": False,
    "read_only": False
})

session_id = session_result["session_id"]

# Write data
client.call_tool("mcp__xlwings-mcp-server__write_data_to_excel", {
    "session_id": session_id,
    "sheet_name": "Sheet1",
    "data": [["Name", "Age", "Score"], ["Alice", 25, 95], ["Bob", 30, 87]]
})

# Apply formulas
client.call_tool("mcp__xlwings-mcp-server__apply_formula", {
    "session_id": session_id,
    "sheet_name": "Sheet1",
    "cell": "D2",
    "formula": "=B2+C2"
})

# Create chart
client.call_tool("mcp__xlwings-mcp-server__create_chart", {
    "session_id": session_id,
    "sheet_name": "Sheet1",
    "data_range": "A1:C3",
    "chart_type": "column",
    "target_cell": "E1"
})

# Close session
client.call_tool("mcp__xlwings-mcp-server__close_workbook", {
    "session_id": session_id
})

🔧 Configuration

Environment Variables

# Session management
EXCEL_MCP_SESSION_TTL=600          # Session TTL in seconds (default: 600)
EXCEL_MCP_MAX_SESSIONS=8           # Maximum concurrent sessions (default: 8)
EXCEL_MCP_DEBUG_LOG=1              # Enable debug logging (default: 0)

# Excel settings
EXCEL_MCP_VISIBLE=false            # Show Excel windows (default: false)
EXCEL_MCP_CALC_MODE=automatic      # Calculation mode (default: automatic)

MCP Configuration (.mcp.json)

{
  "name": "xlwings-mcp-server",
  "version": "1.0.0",
  "transport": {
    "type": "stdio"
  },
  "tools": {
    "prefix": "mcp__xlwings-mcp-server__"
  }
}

📚 API Reference

Session Management

  • open_workbook(filepath, visible=False, read_only=False): Create new session
  • close_workbook(session_id): Close session and save workbook
  • list_workbooks(): List active sessions
  • force_close_workbook_by_path(filepath): Force close by file path

Data Operations

  • write_data_to_excel(session_id, sheet_name, data, start_cell=None)
  • read_data_from_excel(session_id, sheet_name, start_cell=None, end_cell=None)
  • apply_formula(session_id, sheet_name, cell, formula)
  • validate_formula_syntax(session_id, sheet_name, cell, formula)

Worksheet Management

  • create_worksheet(session_id, sheet_name)
  • copy_worksheet(session_id, source_sheet, target_sheet)
  • rename_worksheet(session_id, old_name, new_name)
  • delete_worksheet(session_id, sheet_name)

Formatting & Visualization

  • format_range(session_id, sheet_name, start_cell, **formatting_options)
  • create_chart(session_id, sheet_name, data_range, chart_type, target_cell)
  • create_table(session_id, sheet_name, data_range, table_name=None)

Range Operations

  • merge_cells(session_id, sheet_name, start_cell, end_cell)
  • unmerge_cells(session_id, sheet_name, start_cell, end_cell)
  • copy_range(session_id, sheet_name, source_start, source_end, target_start)
  • delete_range(session_id, sheet_name, start_cell, end_cell)

🏗️ Architecture

Session-based Design

The server implements a sophisticated session management system:

  • ExcelSessionManager: Singleton pattern managing all Excel sessions
  • Per-session Isolation: Each session has independent Excel Application instance
  • Thread Safety: RLock per session preventing concurrent access issues
  • Resource Management: Automatic cleanup with TTL and LRU policies
  • Error Recovery: Comprehensive error handling and session recovery

Performance Optimizations

  • Session Reuse: Eliminates Excel restart overhead between operations
  • Connection Pooling: Efficient COM object management
  • Batch Operations: Optimized for multiple operations on same workbook
  • Memory Management: Proactive cleanup of Excel processes

🧪 Testing

Run Tests

# Run all tests
python -m pytest test/

# Run specific test categories  
python -m pytest test/test_session.py      # Session management
python -m pytest test/test_functions.py   # MCP function tests
python -m pytest test/test_integration.py # Integration tests

Test Coverage

The project maintains 100% test coverage for:

  • All MCP tool functions (17 functions tested)
  • Session lifecycle management
  • Error handling and recovery
  • Performance benchmarks

🔒 Security Considerations

  • File System Access: Server operates within specified directory permissions
  • Excel Process Isolation: Each session runs in separate Excel instance
  • Resource Limits: Configurable session limits prevent resource exhaustion
  • Input Validation: All inputs validated before Excel API calls
  • Safe Defaults: Read-only mode available, invisible Excel instances by default

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Setup

git clone https://github.com/yourusername/xlwings-mcp-server.git
cd xlwings-mcp-server
uv venv
uv sync
uv run python -m xlwings_mcp

📝 Changelog

See CHANGELOG.md for detailed version history.

🐛 Troubleshooting

Common Issues

Excel COM Error: Ensure Excel is properly installed and not running in safe mode

# Check Excel installation
excel --version

Session Not Found: Verify session hasn't expired (default TTL: 10 minutes)

# List active sessions
client.call_tool("mcp__xlwings-mcp-server__list_workbooks")

Permission Denied: Run with appropriate file system permissions

# Windows: Run as administrator if needed

Debug Mode

Enable detailed logging:

export EXCEL_MCP_DEBUG_LOG=1
xlwings-mcp-server

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • xlwings - Excellent Python-Excel integration library
  • Model Context Protocol - Standardized AI-tool communication
  • Claude Code - Development assistance
  • Katherine Johnson - Inspiration for zero-error engineering principles

📞 Support


Made with ❤️ for the Excel automation community

FAQ

What is the xlwings Excel MCP server?
xlwings Excel is a Model Context Protocol (MCP) server profile on explainx.ai. MCP lets AI hosts (e.g. Claude Desktop, Cursor) call tools and resources through a standard interface; this page summarizes categories, install hints, and community ratings.
How do MCP servers relate to agent skills?
Skills are reusable instruction packages (often SKILL.md); MCP servers expose live capabilities. Teams frequently combine both—skills for workflows, MCP for APIs and data. See explainx.ai/skills and explainx.ai/mcp-servers for parallel directories.
How are reviews shown for xlwings Excel?
This profile displays 45 aggregated ratings (sample rows for discoverability plus signed-in user reviews). Average score is about 4.7 out of 5—verify behavior in your own environment before production use.

Use Cases

Extended AI Capabilities

Add new capabilities to Claude beyond text generation

Example

Access external data sources, execute code, interact with tools and services

Transform Claude from chatbot to action-taking agent

Context Enhancement

Provide Claude with access to relevant context and data

Example

Load project documentation, access knowledge bases, query databases

Get more accurate, context-aware responses

Workflow Automation

Automate multi-step workflows combining AI and external tools

Example

Research → Summarize → Create document → Send notification

Complete complex tasks end-to-end without manual steps

Implementation Guide

Prerequisites

  • Claude Desktop 0.7.0+ or Cursor IDE with MCP support
  • Basic understanding of MCP architecture and capabilities
  • Access credentials for integrated services (if required)
  • Willingness to experiment and iterate on configuration

Time Estimate

15-60 minutes depending on server complexity

Installation Steps

  1. 1.Install MCP server: npm install -g [package-name] or via GitHub
  2. 2.Add server configuration to ~/.claude/mcp.json
  3. 3.Provide required credentials and configuration
  4. 4.Restart Claude Desktop to load new server
  5. 5.Test basic functionality with simple prompts
  6. 6.Explore capabilities and experiment with use cases
  7. 7.Document successful patterns for reuse

Troubleshooting

  • MCP server not loading: Check config syntax, verify installation
  • Connection errors: Check network, firewall, credentials
  • Feature not working: Read server docs, check required parameters
  • Performance issues: Monitor resource usage, check for network latency
  • Conflicts with other servers: Check port assignments, namespace collisions

Best Practices

✓ Do

  • +Read server documentation thoroughly before setup
  • +Start with simple use cases to validate functionality
  • +Test in non-production environment first
  • +Monitor resource usage and performance
  • +Keep servers updated for bug fixes and new features
  • +Document configuration for team members
  • +Use environment variables for sensitive configuration

✗ Don't

  • Don't grant overly permissive access to MCP servers
  • Don't skip reading security considerations in docs
  • Don't expose sensitive data without proper controls
  • Don't run untrusted MCP servers without code review
  • Don't ignore error messages—investigate root cause

💡 Pro Tips

  • Combine multiple MCP servers for powerful workflows
  • Create custom MCP servers for your specific needs
  • Share successful configurations with team
  • Use MCP inspector for debugging
  • Join MCP community for tips and troubleshooting

Technical Details

Architecture

Model Context Protocol standardizes how AI hosts (Claude, Cursor) communicate with external tools and data sources through server implementations.

Protocols

  • Model Context Protocol (MCP)
  • JSON-RPC 2.0
  • stdio or HTTP transport

Compatibility

  • Claude Desktop
  • Cursor IDE
  • Custom MCP clients

When to Use This

✓ Use When

Use when you need Claude to access external data, execute actions, or integrate with tools. Best for extending AI capabilities beyond conversation.

✗ Avoid When

Avoid when native integrations exist (use official APIs directly), for real-time critical systems, or when security/compliance requires zero external dependencies.

Integration

  • Tool composition: Chain multiple MCP tools in workflows
  • Context augmentation: Provide AI with relevant external data
  • Action delegation: Let AI execute tasks on external systems
  • Bidirectional sync: Keep AI context and external systems in sync

Discussion

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

List & Promote Your MCP Server

Share your MCP server with the developer community

GET_STARTED →
MCP server reviews

Ratings

4.745 reviews
  • Layla Agarwal· Dec 24, 2024

    xlwings Excel has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.

  • Tariq Brown· Dec 12, 2024

    xlwings Excel is a well-scoped MCP server in the explainx.ai directory — install snippets and categories matched our Claude Code setup.

  • Dhruvi Jain· Dec 8, 2024

    According to our notes, xlwings Excel benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.

  • Yuki Harris· Dec 4, 2024

    We wired xlwings Excel into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.

  • Oshnikdeep· Nov 27, 2024

    We wired xlwings Excel into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.

  • Diya Kim· Nov 23, 2024

    According to our notes, xlwings Excel benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.

  • Tariq Gonzalez· Nov 15, 2024

    xlwings Excel is a well-scoped MCP server in the explainx.ai directory — install snippets and categories matched our Claude Code setup.

  • Amina Yang· Nov 11, 2024

    xlwings Excel is among the better-indexed MCP projects we tried; the explainx.ai summary tracks the official description.

  • Rahul Santra· Nov 7, 2024

    xlwings Excel is among the better-indexed MCP projects we tried; the explainx.ai summary tracks the official description.

  • Pratham Ware· Oct 26, 2024

    We evaluated xlwings Excel against two servers with overlapping tools; this profile had the clearer scope statement.

showing 1-10 of 45

1 / 5