XPyCode
XPyCode is an Excel-Python integration platform that enables you to write, execute, and manage Python code directly within Microsoft Excel workbooks. It provides a seamless bridge between Excel and Python, featuring a full-featured IDE, custom function publishing, package management, and real-time debugging.
Project status
⚠️ This version is at early stage. It is a Beta version.
🚨 Don't use for production or in sensitive environement 🚨
Help Keep the Project Alive
⭐ Add a star in GitHub to promote the project
💵 Donate (for instance 3€ per month)
💬 Join the XPyCode Slack community to ask questions, share feedback, and connect with other users: 👉 Invite link 👉 Workspace
Features
- 🐍 Python Execution in Excel - Run Python code with full access to Excel objects
- 📝 Integrated IDE - Monaco-based code editor with IntelliSense, syntax highlighting, and debugging
- 📦 Package Manager - Install and manage Python packages per workbook with dependency resolution
- 🔧 Custom Functions (UDFs) - Publish Python functions as Excel formulas
- 🎯 Event Handling - React to Excel events (worksheet changes, selections, etc.) with Python
- 🔍 Object Management - Save and re-use objects in python kernel
- 🐛 Debugger - Set breakpoints, step through code, and inspect variables
- 🎨 Theming - Customizable dark/light themes for the IDE
Requirements
- Operating System: Windows 10/11 (64-bit) / Other platforms are enabled but not tested
- Python: 3.9 or higher
- Microsoft Excel: 2016 or later (with Office.js Add-in support)
Installation
pip install xpycode_master
Quick Start
-
Install XPyCode:
pip install xpycode_master
-
Start XPyCode Master:
- For a one-shot test run:
python -m xpycode_master
- For recurring usage:
python -m xpycode_master --setup
- For a one-shot test run:
-
The Excel Add-in will be automatically registered.
Open Excel and look for the XPyCode in Add-Ins -> More Add-Ins -> Shared Folder
-
Launch in Excel:
[Open Console] --> [<> Editor ] -
In XPyCode Editor
- Add a python module: Right click on the workbook -> New Module
- Start coding, using xpycode module:
def updateExcelFromPython(): import xpycode ws=xpycode.worksheets.getActiveWorksheet() rA1=ws.getRange("A1") rA1.values="Hello" rA1.format.fill.color="yellow"
Upgrading
Check for and install updates:
# Check if an update is available
python -m xpycode_master --upgrade --check
# Upgrade interactively
python -m xpycode_master --upgrade
# Upgrade without confirmation
python -m xpycode_master --upgrade --yes
Usage
Running Python Code
- Open a workbook in Excel
- Click "Open Console" in the XPyCode ribbon
- Open Editor with "<>" button
- Right click on the workbook name and add a python module
- Write Python code in the editor
- Press F5 or click "Run" to execute
Publishing Custom Functions
# In your module, define a function
def add_numbers(a: float, b: float) -> float:
"""Add two numbers together."""
return a + b
Then use the Function Publisher in the IDE to expose it as an Excel formula: =ADD_NUMBERS(A1, B1)
Package Management
- Open the Package Manager panel in the IDE
- Search for a package (e.g., "pandas")
- Select version and optional extras
- Click "Install/Update" to install for the current workbook
Configuration
Configure themes, pypi urls, console preferences, ... in File/Settings menu
Excel Sample
You will find an Excel workbook sample in xpycode_master\excel_sample.
Dependencies
Core Dependencies
- fastapi >= 0.100.0 - Web framework for the Business Layer API
- uvicorn >= 0.22.0 - ASGI server for FastAPI
- websockets >= 12.0 - WebSocket client/server implementation
- aiohttp >= 3.8.0 - Async HTTP client for package index queries
- packaging >= 21.0 - Version parsing and specifier handling
- PySide6 >= 6.5.0 - Qt bindings for the IDE GUI (includes WebEngine for Monaco Editor embedding)
- jedi >= 0.19.0 - Python autocompletion and static analysis
- orjson >= 3.9.15 - Fast JSON serialization (recommended)
- keyring >= 24.0.0 - Secure credential storage for AI providers
- unearth >= 0.14.0 - Enhanced package discovery
Architecture
XPyCode consists of several interconnected components:
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Excel Add-in │◄───►│ Business Layer │◄───►│ Python IDE │
│ (Office.js) │ │ (FastAPI) │ │ (PySide6) │
└─────────────────┘ └────────┬────────┘ └─────────────────┘
│
▼
┌─────────────────┐
│ Python Kernel │
│ (per workbook) │
└─────────────────┘
- Excel Add-in: Office.js-based add-in providing the Excel interface
- Business Layer: FastAPI server acting as message broker between components
- Python Kernel: Per-workbook Python execution environment
- Python IDE: PySide6-based development environment with Monaco Editor
License
This project is licensed under the MIT License with Commons Clause.
You are free to use, modify, and distribute this software for any purpose. However, you may not sell the software or include it as a substantial part of a commercial product or service.
See the LICENSE file for full details.
Author
BGE Advisory
Feedbacks
Contributions are welcome! Please feel free to submit issues.
Support
- Issues: GitHub Issues
- Documentation: Docs
Acknowledgments
- Monaco Editor - Code editor component
- Office.js - Excel Add-in API
- FastAPI - Modern Python web framework
- PySide6 - Qt bindings for Python
Metadata
Release files for xpycode-master 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xpycode_master-0.2.1.tar.gz | 9.7 MB | Details |
Built distributions (wheels)
Total release size: 172.8 MB
Release files / xpycode_master-0.2.1.tar.gz
| Download URL | xpycode_master-0.2.1.tar.gz |
|---|---|
| Size | 9.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b23a0aa06af4c1deb9e04cbebf63e07fa3cc8be5893a78d57850adc2fb4843ef
|
|
BLAKE2b-256 checksum How to use checksums |
edf146003231ab5f5f6da5aadb33bf5fbc7238e20073476f6099b3c82f6d33bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / xpycode_master-0.2.1-py3-none-any.whl
| Download URL | xpycode_master-0.2.1-py3-none-any.whl |
|---|---|
| Size | 9.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b239a7fb317300da1433c901ee58f0ae80202034f35693b1c70e7379ac5e08ff
|
|
BLAKE2b-256 checksum How to use checksums |
507f6280c158ef76838e60e9d520f91d2ac21e8455e53a303400767b95ca1545
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / xpycode_master-0.2.1-cp314-cp314t-win_amd64.whl
| Download URL | xpycode_master-0.2.1-cp314-cp314t-win_amd64.whl |
|---|---|
| Size | 11.3 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Windows x86-64 |
|
SHA-256 checksum How to use checksums |
9aa643785e3345436aaccd27ab93fa43463c04bdd9fc37cbe6b948d7fc2aa2ba
|
|
BLAKE2b-256 checksum How to use checksums |
9461ed2db0cfd12c967a8276b8eab83dd19d9bb6f3faebb2c06296fe1d67f44e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / xpycode_master-0.2.1-cp314-cp314t-win32.whl
| Download URL | xpycode_master-0.2.1-cp314-cp314t-win32.whl |
|---|---|
| Size | 11.0 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Windows x86-32 |
|
SHA-256 checksum How to use checksums |
377df9bd98b3e9d96ba17de1cb3b5fb38565bc8aad73f0020b54b6045b6326f0
|
|
BLAKE2b-256 checksum How to use checksums |
aabc3cac70a5220e3d23bf355a2d777f163dda1e8f4096612c4ab634cbd87f78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / xpycode_master-0.2.1-cp314-cp314-win_amd64.whl
| Download URL | xpycode_master-0.2.1-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 11.0 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
55400fdd3a9ac8008bca0aec1c7627685d8477aa7638f47d0d977ff67e6be71d
|
|
BLAKE2b-256 checksum How to use checksums |
14f8a068c49b41f0d79446062cb3a5eacdd5b4f14df9a1384c495c07f5715114
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / xpycode_master-0.2.1-cp314-cp314-win32.whl
| Download URL | xpycode_master-0.2.1-cp314-cp314-win32.whl |
|---|---|
| Size | 10.8 MB |
| Tags | CPython 3.14 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
dfc86db728d9cdb615a4e322cf5ceaa3b09ec14a7d4b225a9cc9bbc0eb5421b5
|
|
BLAKE2b-256 checksum How to use checksums |
e6e72c56232789eb63abf1765f6abfcca4c49663f4b328f8eb7823c705310752
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / xpycode_master-0.2.1-cp313-cp313-win_amd64.whl
| Download URL | xpycode_master-0.2.1-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 11.0 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1359ae2df224dfe5ae72cd6abc29d5c3e948a0e1dcffd57b9f520c0942dcb738
|
|
BLAKE2b-256 checksum How to use checksums |
ae018668f152be42d6bce8798ec07029c896149867ebaf222ca793caf2a2f96d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / xpycode_master-0.2.1-cp313-cp313-win32.whl
| Download URL | xpycode_master-0.2.1-cp313-cp313-win32.whl |
|---|---|
| Size | 10.8 MB |
| Tags | CPython 3.13 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
bfbe1f2d6f44fbd2c265ce65f67a36fcc88df6cc97972a2e5df558088d1abf61
|
|
BLAKE2b-256 checksum How to use checksums |
ec9ce48345da3e827854c247ec5236bafd547ff9f1149211f9198eafbc9b2097
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / xpycode_master-0.2.1-cp312-cp312-win_amd64.whl
| Download URL | xpycode_master-0.2.1-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 11.0 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1f4243d8976e7251cd8dd876162874e05e11c67046e175e5344bc5e8c49fdfbe
|
|
BLAKE2b-256 checksum How to use checksums |
a30bd62f0826f0e1abce480e3bb1f60e671ed7a766393af03ae95a9e2f830770
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / xpycode_master-0.2.1-cp312-cp312-win32.whl
| Download URL | xpycode_master-0.2.1-cp312-cp312-win32.whl |
|---|---|
| Size | 10.8 MB |
| Tags | CPython 3.12 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
0dae222dac578a6a7ec7638e799e15e4f461e7dc44648289e9e05d64d8eb3cfa
|
|
BLAKE2b-256 checksum How to use checksums |
ab196834420023fab93cc45f7f41f8d6c40f75a7f73c577218fea19bc176c07d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / xpycode_master-0.2.1-cp311-cp311-win_amd64.whl
| Download URL | xpycode_master-0.2.1-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 11.1 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e18572dce031b4ce99a93e9c8d74ede1aa23c264a490fe0aadc872a9986e466f
|
|
BLAKE2b-256 checksum How to use checksums |
eb7c224e18b7864c9097ca42a3d0a32b2c70c2c88e76c55a8b95936219ff7c30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / xpycode_master-0.2.1-cp311-cp311-win32.whl
| Download URL | xpycode_master-0.2.1-cp311-cp311-win32.whl |
|---|---|
| Size | 10.8 MB |
| Tags | CPython 3.11 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
966089be966fb3203a59cbd8216779923c7c8c65cb169805dce50a9d68723907
|
|
BLAKE2b-256 checksum How to use checksums |
03f3f9dac5fb0ed77cf0f4bde0c371cda13c5c57f0d03cb9390bce7faa978cf7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / xpycode_master-0.2.1-cp310-cp310-win_amd64.whl
| Download URL | xpycode_master-0.2.1-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 11.1 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2d8a4ea4d2628965befa5d069d39d202f70611b23b8557ed384305fe5233348c
|
|
BLAKE2b-256 checksum How to use checksums |
491bcca7a105706637269b7e7b160d7c9c858742c91912a3e4d86ac0f3a4fbe7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / xpycode_master-0.2.1-cp310-cp310-win32.whl
| Download URL | xpycode_master-0.2.1-cp310-cp310-win32.whl |
|---|---|
| Size | 10.8 MB |
| Tags | CPython 3.10 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
4aa879a0e4a436cc368a4a111de2ca818b2ade0b1dfce8868769f25a53f9dd5f
|
|
BLAKE2b-256 checksum How to use checksums |
bf116f77bb9866f630f04d8d8ab31816121d31bd18c267e58168a92df3abeacb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / xpycode_master-0.2.1-cp39-cp39-win_amd64.whl
| Download URL | xpycode_master-0.2.1-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 11.1 MB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a26a22f201fae18d6dedf5e388f909b38d862a4b182ee378c410fbd9fdd75be5
|
|
BLAKE2b-256 checksum How to use checksums |
861cb01a27f3c3599019b9fe2b1059140b531207edcb6a6ffef6d9769f43f46d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / xpycode_master-0.2.1-cp39-cp39-win32.whl
| Download URL | xpycode_master-0.2.1-cp39-cp39-win32.whl |
|---|---|
| Size | 10.8 MB |
| Tags | CPython 3.9 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
2cd51b96aab7cdd07db27813c12975f842fe6dd1420afce1056f82b7dc51bdd4
|
|
BLAKE2b-256 checksum How to use checksums |
528017b7bf4dd308afece13ae993fb97d46e2d1cd2eac8f61b74bde3bbad4f8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|