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.10.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.10-py3-none-any.whl (65.5 MB view details)

Uploaded Python 3

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

Uploaded CPython 3.14tWindows x86-64

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

Uploaded CPython 3.14tWindows x86

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

Uploaded CPython 3.14Windows x86-64

xpycode_master-0.1.10-cp314-cp314-win32.whl (26.3 MB view details)

Uploaded CPython 3.14Windows x86

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

Uploaded CPython 3.13Windows x86-64

xpycode_master-0.1.10-cp313-cp313-win32.whl (25.7 MB view details)

Uploaded CPython 3.13Windows x86

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

Uploaded CPython 3.12Windows x86-64

xpycode_master-0.1.10-cp312-cp312-win32.whl (25.7 MB view details)

Uploaded CPython 3.12Windows x86

xpycode_master-0.1.10-cp311-cp311-win_amd64.whl (26.0 MB view details)

Uploaded CPython 3.11Windows x86-64

xpycode_master-0.1.10-cp311-cp311-win32.whl (25.8 MB view details)

Uploaded CPython 3.11Windows x86

xpycode_master-0.1.10-cp310-cp310-win_amd64.whl (26.0 MB view details)

Uploaded CPython 3.10Windows x86-64

xpycode_master-0.1.10-cp310-cp310-win32.whl (25.8 MB view details)

Uploaded CPython 3.10Windows x86

xpycode_master-0.1.10-cp39-cp39-win_amd64.whl (26.0 MB view details)

Uploaded CPython 3.9Windows x86-64

xpycode_master-0.1.10-cp39-cp39-win32.whl (25.8 MB view details)

Uploaded CPython 3.9Windows x86

File details

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

File metadata

  • Download URL: xpycode_master-0.1.10.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.10.tar.gz
Algorithm Hash digest
SHA256 596d67d2dbf826046e3c40c3773780c335b134f83888769510a052ce71ca147a
MD5 51e3a7299ea3fa89b5652705d78f8bb2
BLAKE2b-256 0dc8fbc9c88929dc66e87df899536d3bf062bff4afcbe7eb39c1ff91c4168bab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 f2b32719a105aa4e78d9e3cbf2a1c365d059301c85d15c1d7299c4d6521762fd
MD5 23a195369a189c26e892ecec018d4995
BLAKE2b-256 f46903e9e89c68445131006a7f49f062ac286c26162455b3f115c9c08aee7e7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.10-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 5b2296c148386fbafc4e227f76a81b1f6a96c02bf413157ca686dc00e23c8eea
MD5 8bf315b15a99d3ed45c2ae3cbd9f1899
BLAKE2b-256 9b7984774e5287004f869a3168198045a52b8cc0c2adad279bc1a8cace7ec331

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.10-cp314-cp314t-win32.whl
Algorithm Hash digest
SHA256 388a8e5e5f533f4f64aa0fa04780f44e5df91bff784893b4d0349e4721b24b11
MD5 983266d3dc261beeb3903a7f9754396d
BLAKE2b-256 fc2324006a9477e0fb87fb253fa46f646934eba425838b4350e56ca55df31da9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.10-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 0da7edcbd4938fe42fa5696e1618fc1a98114f7d72b98ad9b7830c7c83e12d4b
MD5 9fdd4be5df22049c27e38c3f7fc848c4
BLAKE2b-256 dc97b5d73902cb9a1ef3036f44989f19ae093dc3349504ce7f2f577d884e057c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.10-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 ce2ceeae2e4f2aea95ac116c7cd82f5f885a42edf40e5cbbc13fd4378c019f86
MD5 6caae06c3543859c2390302d2d3805a5
BLAKE2b-256 fbbe4dcb92083bef8b41612b983269ed7a2ca90efb7398a98403bad9fa8d7e65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.10-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 972dacaff77570bf4958eb7084fadffe5f3b2303d5de15c56266142e71350ee1
MD5 cfafc0765230f1ec076ca8f5134b6cbc
BLAKE2b-256 1b5e2e15caf7ba9aa3785700f98e615544c665a49c4f3ec52596e149ddbaa151

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.10-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 54850072849544a21acfdb25e2deda163d8b7e1b5c5289ae34d15b1717f83b89
MD5 e8cdbadeb92815d25fc3a774d50e458a
BLAKE2b-256 54b785615885810e75bd2e4015009e9dbb908416203f8528e299a35cc9180e97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.10-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 970ae8252f7b60834ce4d208ee0e1a86192ab0d560d041517fbc47e8c9abd2f7
MD5 1f4a1ab153f71b11a721c983f8ede2c7
BLAKE2b-256 f5ed5b3af2cdab19a03684741a2978027d342745c520f942a820a5bd1382c29d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.10-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 04a91f6ef940579111d316d8fbb471ec79154c6e9ecd163375582d6530750842
MD5 ec746195f15c6962e7303cf6f368e88e
BLAKE2b-256 c28a997f884a599f1224e63f0e687adfb2d4bb8af4699901cc916632ec425049

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.10-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 96a2e56139000ee7b18a96818940c3155f835ef1284f6d6f4c44161cad1673a4
MD5 69f15a1bbf691ceb84138b138288e684
BLAKE2b-256 2626d024f9ccb578e6e4de5746edfd7083c450ed12f6fac42730bf98f83ba430

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.10-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 38dd8f6fbfd28a211adee6a10c639913876949798e53e919dd36c997128f2581
MD5 49a2e6ed60271cff466cf268addaa133
BLAKE2b-256 6f64c7fba1bd8129e6c7663955f08f26382e59ab599265d59e5257277b6c2e7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.10-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2589c5bb7f862cb834598bfc2ec67f1b9ba93fa4b0afcb539c537fdce5667fb7
MD5 aaf9832510b67ee5ae0b5adba7e252af
BLAKE2b-256 ce2c5c832785aecc14a62b3a15a31a79395dd290540834c3336b9e9d99d2846f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.10-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 4338b21b39135aa9b9ede1a12a917d3989efbdd0ef8371fc8fccc0a24e2d6a63
MD5 770f4423a14799274b24e0295df5b661
BLAKE2b-256 ee7e85f325ae04af80f4862a5a3c757b4d4e9673347f6180c2af542ee03e5e1b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.10-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 38e0f74a87014835b5f005d9ffa8b68f9812392fe031910d52139731d684298f
MD5 9284f496bacdcb3dd1fdabf6e2ac34ec
BLAKE2b-256 cc774dab5e6621007838b3fb987830b9a4303337aa15fb1a89f45e5302d4e330

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.10-cp39-cp39-win32.whl
  • Upload date:
  • Size: 25.8 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.10-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 499bd4f119e1669a120d6ad77b0a0649b76e451e4dd87e1d24d5387a88fd32e3
MD5 51bf0a4344f801cf7501444bee4a93e4
BLAKE2b-256 edd838821289e31f85c4f08a15ae976f173e362a3001dac43b4f24eabe58138c

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