Claude AI terminal inside Microsoft Excel using PyXLL.
Project description
pyxll-claude
A PyXLL extension that embeds a Claude Code terminal directly into Microsoft Excel as a dockable Custom Task Pane.
Chat with Claude in natural language to write Python functions, read and write cell data, format spreadsheets, manage sheets, and inspect the live state of your workbook — all without leaving Excel.
How it works
- Click Claude in the PyXLL ribbon tab to open the task pane.
- Chat with Claude — ask it to build formulas, analyse data, format a table, or write Python functions.
- Claude uses a set of built-in MCP tools to interact with Excel directly: reading ranges, writing values, formatting cells, managing sheets, and more.
- When Claude writes new Python functions into
pyxll_claude_functions.pyit callspyxll_reload_moduleto register them with Excel immediately — no restarts or button presses needed.
The workspace is automatically bootstrapped with a CLAUDE.md and a /fetch-pyxll-docs skill so Claude has full PyXLL context before you type anything. Authentication and model selection are handled entirely by the claude CLI.
Requirements
- Windows (Excel + PyXLL are Windows-only)
- Python 3.10+ (must match the Python that PyXLL uses)
- PyXLL 5.1+ installed and configured in Excel
- Claude Code CLI (
claude) installed and authenticated - uv (for development)
Installation
uv pip install pyxll-claude
Or for development:
uv sync
uv pip install -e .
PyXLL discovers the extension automatically via setuptools entry points — no changes to pyxll.cfg are required.
Configuration
All settings go in a [CLAUDE] section of your pyxll.cfg. Every setting is optional.
| Setting | Default | Description |
|---|---|---|
workspace |
pyxll_claude_workspace next to the PyXLL add-in |
Path to the workspace folder that holds pyxll_claude_functions.py, CLAUDE.md, and the .claude directory. |
mcp_port_range |
54717-54816 |
Inclusive range of ports tried in order when starting the MCP server. The first free port is used. |
mcp_autostart |
0 |
Set to 1 (or true/yes) to start the MCP server automatically when Excel opens, instead of requiring a manual click on the ribbon button. |
Example:
[CLAUDE]
workspace = C:\path\to\your\workspace
mcp_port_range = 54717-54816
mcp_autostart = 1
The workspace folder is created and bootstrapped automatically on first open. It will contain:
pyxll_claude_functions.py ← your Excel functions (Claude edits this)
CLAUDE.md ← PyXLL context loaded automatically by Claude
.claude/
settings.local.json ← pre-approved permissions for safe tools
skills/
fetch-pyxll-docs/
SKILL.md ← skill that fetches authoritative PyXLL docs
Usage
Writing Excel functions
Ask Claude to write a function in plain English:
"Write an Excel function that returns the transpose of a range as a numpy array"
Claude fetches the live PyXLL documentation, writes the function into pyxll_claude_functions.py, then calls pyxll_reload_module to register it with Excel — no button press needed.
You can also view and edit pyxll_claude_functions.py directly in the Functions tab, which hosts a Monaco code editor. Saving the file there (Ctrl+S) triggers the same reload automatically.
Working with spreadsheet data
Claude can read and write your spreadsheet directly:
"Read the sales table on Sheet2 and add a total row at the bottom"
"Format the header row in A1:F1 as bold white text on a dark blue background"
"Insert two rows above row 5 and add column headers"
"Save the workbook"
Inspecting the workbook
"What sheets does this workbook have?"
"What's in the current selection?"
"Take a screenshot so I can see the current state"
"Show me the named ranges defined in this workbook"
Check %APPDATA%\PyXLL\pyxll.log if something doesn't appear as expected.
MCP tools
A local MCP server runs inside Excel's Python process and exposes the following tools to Claude. Read-only tools are pre-approved and run without prompting; write tools ask for confirmation.
PyXLL environment
| Tool | Purpose |
|---|---|
pyxll_reload_module |
Reload a workspace module and rebind @xl_func functions |
pyxll_get_log |
Read the tail of the PyXLL log file |
pyxll_get_config |
Read the parsed pyxll.cfg |
pyxll_get_config_path |
Locate the pyxll.cfg file |
pyxll_get_version |
PyXLL version string |
pyxll_get_python_version |
Python version string |
Reading the workbook
| Tool | Purpose |
|---|---|
pyxll_get_sheets |
List all worksheet names in the active workbook |
pyxll_get_used_range |
Bounds and dimensions of the populated area of a sheet |
pyxll_get_selection |
Current Excel selection (sheet + address) |
pyxll_get_cell_info |
Value, formula, number format and full styling for one cell |
pyxll_get_named_ranges |
All defined names in the active workbook |
pyxll_read_range |
Read cell values from a worksheet range |
pyxll_read_formulas |
Read cell formulas from a worksheet range |
pyxll_screenshot |
Capture the Excel window as a PNG image |
Writing and editing
| Tool | Purpose |
|---|---|
pyxll_write_range |
Write values or formulas to a worksheet range |
pyxll_clear_range |
Clear contents, formats, or both from a range |
pyxll_format_cells |
Apply font, fill, alignment, borders, and number format |
pyxll_auto_fit_column |
Auto-fit column width to content |
pyxll_set_column_width |
Set an explicit column width |
pyxll_set_row_height |
Set an explicit row height |
Structure
| Tool | Purpose |
|---|---|
pyxll_insert_rows |
Insert blank rows, shifting existing rows down |
pyxll_insert_columns |
Insert blank columns, shifting existing columns right |
pyxll_merge_cells |
Merge a range into a single cell |
pyxll_unmerge_cells |
Unmerge previously merged cells |
pyxll_add_sheet |
Add a new worksheet to the workbook |
pyxll_name_range |
Create or update a workbook-level named range |
pyxll_save_workbook |
Save the active workbook |
pyxll_calculate |
Force recalculation at workbook, sheet, or range scope |
Project structure
pyxll-claude/
├── pyproject.toml
├── docs/
│ └── spec.md # Full project specification
└── src/
└── pyxll_claude/
├── __init__.py # pyxll_modules() and pyxll_ribbon() entry points
├── task_pane.py # PySide6 CTP widget (Terminal + Functions tabs)
├── mcp_server/ # Local MCP server
│ ├── server.py # HTTP server and JSON-RPC dispatch
│ └── tools/ # One module per MCP tool
├── workspace.py # First-run workspace initialisation
├── xl_functions.py # @xl_on_open handler and ribbon callbacks
├── widgets/
│ ├── terminal.py # Claude CLI subprocess + xterm.js terminal
│ └── editor.py # Monaco editor for pyxll_claude_functions.py
├── webview/
│ ├── client.py # Parent-process WebViewClient (child-process embedding)
│ └── child_process.py # Child process hosting QWebEngineView
└── resources/
├── ribbon.xml # Excel ribbon XML
├── terminal.html # xterm.js page
└── editor.html # Monaco editor page
Architecture notes
- Terminal: xterm.js served from a child process
QWebEngineView, connected to theclaudeCLI via a pywinpty ConPTY. The child process is embedded into the parent window via Win32SetParent.windowsMode: trueprevents resize conflicts between xterm.js and ConPTY. - Code editor: Monaco editor also runs in a child-process
QWebEngineView. It watchespyxll_claude_functions.pyfor external changes and reloads automatically. - MCP server: A lightweight Streamable HTTP server (MCP protocol 2025-03-26) runs on localhost in a daemon thread inside Excel's Python process. Each tool runs its COM operations on Excel's main thread via
pyxll.schedule_call. The server survives PyXLL reloads by persisting as a singleton insys.modules. - Workspace bootstrap:
workspace.pycreates missing files on first open but never overwrites existing ones, so user edits are preserved across upgrades.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyxll_claude-0.1.2.tar.gz.
File metadata
- Download URL: pyxll_claude-0.1.2.tar.gz
- Upload date:
- Size: 136.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d75852ec616fe978edcf0be7ef29fb8bb2a7848fd3b40b618b8ac3fcc225f21f
|
|
| MD5 |
6d3792504e6fecee7fbf38bd631a4817
|
|
| BLAKE2b-256 |
2e5a5d3c0cb09ea67d96ee201c64277e7c19c8b5cc6b653d49fdb13d05c884f9
|
Provenance
The following attestation bundles were made for pyxll_claude-0.1.2.tar.gz:
Publisher:
pypi-upload.yaml on pyxll/pyxll-claude
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyxll_claude-0.1.2.tar.gz -
Subject digest:
d75852ec616fe978edcf0be7ef29fb8bb2a7848fd3b40b618b8ac3fcc225f21f - Sigstore transparency entry: 1839329515
- Sigstore integration time:
-
Permalink:
pyxll/pyxll-claude@24c8ef84b08420066c1f2cb6902e947a4cd4f3a0 -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/pyxll
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-upload.yaml@24c8ef84b08420066c1f2cb6902e947a4cd4f3a0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyxll_claude-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pyxll_claude-0.1.2-py3-none-any.whl
- Upload date:
- Size: 169.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6d3286991e5bfd6dcc394a72c7e82d93ff5388e925a9b9d8c9d3ee7997c0d35
|
|
| MD5 |
254d7ba191ebe56b1b0f86e67c061ccd
|
|
| BLAKE2b-256 |
076c79470905eeb74bd1ba7639b99aa68a3a631b1953d283c511a011e7ddae34
|
Provenance
The following attestation bundles were made for pyxll_claude-0.1.2-py3-none-any.whl:
Publisher:
pypi-upload.yaml on pyxll/pyxll-claude
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyxll_claude-0.1.2-py3-none-any.whl -
Subject digest:
f6d3286991e5bfd6dcc394a72c7e82d93ff5388e925a9b9d8c9d3ee7997c0d35 - Sigstore transparency entry: 1839329656
- Sigstore integration time:
-
Permalink:
pyxll/pyxll-claude@24c8ef84b08420066c1f2cb6902e947a4cd4f3a0 -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/pyxll
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-upload.yaml@24c8ef84b08420066c1f2cb6902e947a4cd4f3a0 -
Trigger Event:
release
-
Statement type: