Skip to main content

XPyCode Master - Python scripting for Excel with VBA-like interface

Project description

XPyCode

Python 3.9+ License: MIT + Commons Clause Platform: Windows Platform: Linux/macOS (experimental)

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 an Alpha version, almost Beta.

๐Ÿšจ 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

  1. Install XPyCode:

    pip install xpycode_master
    
  2. Start the XPyCode Master server:

    python -m xpycode_master
    
  3. The Excel Add-in will be automatically registered.

    Open Excel and look for the XPyCode in Add-Ins -> More Add-Ins -> Shared Folder

  4. Launch in Excel:

    [Open Console] --> [<> Editor ]
    
  5. 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"
    

Running as a Service

XPyCode can run as a system service for automatic startup:

# Install and start as a service
python -m xpycode_master service install

# Check status
python -m xpycode_master service status

# Stop service
python -m xpycode_master service stop

Supported on Windows, Linux (systemd), and macOS (launchd). See Service Management for details.

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

If XPyCode is running as a service, the upgrade process will automatically stop and restart the service.

Addin Hosting Modes

XPyCode supports two modes for running the Excel add-in:

External Mode (Default)

The add-in UI is served from https://addin.xpycode.com. This is the default mode and requires no certificate management.

python -m xpycode_master

Local Mode

The add-in UI is served from a local HTTPS server on your machine. Requires self-signed certificates.

python -m xpycode_master --use-local-addin

!!! warning "Mode Switch Cache Clearing" When switching between local and external modes, XPyCode will automatically clear the Office add-in cache. This affects all Office add-ins, not just XPyCode. You may need to restart Excel after switching modes.

Usage

Running Python Code

  1. Open a workbook in Excel
  2. Click "Open Console" in the XPyCode ribbon
  3. Open Editor with "<>" button
  4. Right click on the workbook name and add a python module
  5. Write Python code in the editor
  6. 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

  1. Open the Package Manager panel in the IDE
  2. Search for a package (e.g., "pandas")
  3. Select version and optional extras
  4. 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

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xpycode_master-0.1.16.tar.gz (65.6 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

xpycode_master-0.1.16-py3-none-any.whl (65.5 MB view details)

Uploaded Python 3

xpycode_master-0.1.16-cp314-cp314t-win_amd64.whl (26.9 MB view details)

Uploaded CPython 3.14tWindows x86-64

xpycode_master-0.1.16-cp314-cp314t-win32.whl (26.6 MB view details)

Uploaded CPython 3.14tWindows x86

xpycode_master-0.1.16-cp314-cp314-win_amd64.whl (26.6 MB view details)

Uploaded CPython 3.14Windows x86-64

xpycode_master-0.1.16-cp314-cp314-win32.whl (26.4 MB view details)

Uploaded CPython 3.14Windows x86

xpycode_master-0.1.16-cp313-cp313-win_amd64.whl (26.0 MB view details)

Uploaded CPython 3.13Windows x86-64

xpycode_master-0.1.16-cp313-cp313-win32.whl (25.8 MB view details)

Uploaded CPython 3.13Windows x86

xpycode_master-0.1.16-cp312-cp312-win_amd64.whl (26.0 MB view details)

Uploaded CPython 3.12Windows x86-64

xpycode_master-0.1.16-cp312-cp312-win32.whl (25.8 MB view details)

Uploaded CPython 3.12Windows x86

xpycode_master-0.1.16-cp311-cp311-win_amd64.whl (26.1 MB view details)

Uploaded CPython 3.11Windows x86-64

xpycode_master-0.1.16-cp311-cp311-win32.whl (25.9 MB view details)

Uploaded CPython 3.11Windows x86

xpycode_master-0.1.16-cp310-cp310-win_amd64.whl (26.1 MB view details)

Uploaded CPython 3.10Windows x86-64

xpycode_master-0.1.16-cp310-cp310-win32.whl (25.9 MB view details)

Uploaded CPython 3.10Windows x86

xpycode_master-0.1.16-cp39-cp39-win_amd64.whl (26.1 MB view details)

Uploaded CPython 3.9Windows x86-64

xpycode_master-0.1.16-cp39-cp39-win32.whl (25.9 MB view details)

Uploaded CPython 3.9Windows x86

File details

Details for the file xpycode_master-0.1.16.tar.gz.

File metadata

  • Download URL: xpycode_master-0.1.16.tar.gz
  • Upload date:
  • Size: 65.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for xpycode_master-0.1.16.tar.gz
Algorithm Hash digest
SHA256 1f78e840f5e36e7e56efb4baff04618d3ea139b7b1e0c84b0dce37c3b37d3606
MD5 3be9e73dcd0b7d91d275691d2dc5c906
BLAKE2b-256 8300d8c46432c2ad4534c9f3f493b3e25278ecc953c0f4229b62d5f9831b46d5

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.16-py3-none-any.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.16-py3-none-any.whl
Algorithm Hash digest
SHA256 68e955aa92496cac8a7e0f3383493b7e59b7a006a5a73fa9dabc6c8c897e9d60
MD5 f9be5fa93ac3c52518f46db950467bb8
BLAKE2b-256 359546e05df5fdfd830104646cc828187a3499864a96cfc850ca7502b30c3c0a

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.16-cp314-cp314t-win_amd64.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.16-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 3f09f734922ff740bde99e26e30331f4742b3c14fd4e21dcddf20ec6312c052e
MD5 cbeb4f2a23848b3c477db18a59a82dd3
BLAKE2b-256 daeefd7b682854d4aed0cb0ddb81e0a581db8d470cabdcbc5b9d7c3a0a63485b

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.16-cp314-cp314t-win32.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.16-cp314-cp314t-win32.whl
Algorithm Hash digest
SHA256 a0fa134e5d2500539be6f2f06bfc3487ff1838d3e184bed10aedead1f5378b24
MD5 8dc3e94b26803cc6d6582957815dbccb
BLAKE2b-256 2fd0eabfb5fae88c5f190cb1a6d71ba131dea4bc2431b5edecf1fe00c09da3f9

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.16-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.16-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 01a1ed13705f452303927c85ac647b158a61867c38d4ff09024eb387fb62b121
MD5 3a148e04baa28e1fdefac12fbdfd0015
BLAKE2b-256 eb672c4b26c6519e53cf5885740230241703b82dbf3e196133d6e82553923499

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.16-cp314-cp314-win32.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.16-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 b76b4526736bef774e79ea83a6946b6b7f89dd5c1f6a6dd6cace4c443ddb9da8
MD5 d49b0c3d6fb8a231ab32ad44e25d1544
BLAKE2b-256 c8e46a4a1bfdbdb64db7d862358775186c8595b799e98ebb78517bda7949eff9

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.16-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.16-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1e38ce40e75dfce59e8f3e35ceda2ab6079feec6b9791ddb76af4b96b5f8f6ca
MD5 6557731838760eb6f68d7591075ba019
BLAKE2b-256 043bdfffd0069a2a206664e976d6eb0a1c5354bed35df28922f379dd7548dca7

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.16-cp313-cp313-win32.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.16-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 773f0bd6ee4064333362280de28a7c30234328bd3b3be87ceed9c11d8ac17727
MD5 d851c417d02e7338ffc8a3c44ca8701c
BLAKE2b-256 8a72711538a84d3697545095790712c4cebcffc728c43092814ad5098729f456

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.16-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.16-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d5035cfce62a613ae28f13df9dbda07876221050db37eb60bf7a438d26f0d437
MD5 9f750a42fa2d76d3e5b127f6fd2b9246
BLAKE2b-256 3a71781061edda3f6f11d170a482f76408284f9b8e9e8a99b79355bcb16167bb

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.16-cp312-cp312-win32.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.16-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 9ac9a9ec56833ea544f183160895b2bc156580c6c756bea1933acf04831fe1ca
MD5 5e331ee2c8a40300cc32b453f11820a4
BLAKE2b-256 8cb89163b752e34fb1d5c6f9ac0f326363620ad47e039ad5f4a0148a29081414

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.16-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.16-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c09cd2095c789f69185ca982096c44fb0abb7d7a4632f8c27273bfa38e2d128f
MD5 3eed8422301e2e3dc425347b3b568d51
BLAKE2b-256 1d4d1829e97670e8df5cbb8e4a545395bb1002cde6dc2084a09cb00ce4d5429a

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.16-cp311-cp311-win32.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.16-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 b68ede655c3de761577bb6ebf6ecdd225bfb35f9475c3c21253719bee9bc1ff1
MD5 15c184cd9db973693a1ffa5c1394cd71
BLAKE2b-256 12b64f9468d0587999636e8f6598ad2168ec2333f21e405eb96ffae1fa25fafe

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.16-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.16-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7788d19fb7926bf5b2d5c3b077c578e71d9b601a46670c9ffeb00b6ea63abab7
MD5 afc67c49e9f6531abea78d77d2e8d24a
BLAKE2b-256 53218af97ab07d7547364857d94d95fb428d051fabba3443382b1819c2766681

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.16-cp310-cp310-win32.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.16-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 d7f6260cae232a8c80714b8d97dcca1f83df7d11a796cb33e28a482aef59106b
MD5 75d5a31f11628a2344af223fd697ade9
BLAKE2b-256 3e71762b5fad45d4bdcb9eea9bb4f1a429c2e42ec5874710960d5910ec760be5

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.16-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.16-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 d18bd00544b15f4f5aee3a44a9543682b0654b8e1039909cbcb0bd531a4c435c
MD5 d74049b2f9acb76207c927ddd9abdf4c
BLAKE2b-256 2f86cd74dae3e770fcc238a2a37741942bd9a9a6a68e0730c02ce90eaf35b552

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.16-cp39-cp39-win32.whl.

File metadata

  • Download URL: xpycode_master-0.1.16-cp39-cp39-win32.whl
  • Upload date:
  • Size: 25.9 MB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for xpycode_master-0.1.16-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 7229f2182559fe3d27af2694501e9c6ef637d4c8e9cc769143fbedefa65bb799
MD5 17d1a3b304269513478fc74366f2ea5b
BLAKE2b-256 23d37d1ac3610ada8c33565b12f43ccf40c377947a347265d0f465954686f973

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page