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

Uploaded Python 3

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

Uploaded CPython 3.14tWindows x86-64

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

Uploaded CPython 3.14tWindows x86

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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14Windows x86

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

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

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9Windows x86

File details

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

File metadata

  • Download URL: xpycode_master-0.1.15.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.15.tar.gz
Algorithm Hash digest
SHA256 bdfffeabfbbff00ab36fdc5cfb37a914acda3a0675a3af245b6a80c5c8f97aed
MD5 895094d3f70940ef88cf2d956b73e908
BLAKE2b-256 d9d3f7907b7c6f0c1399346f77d94a2b168f0cf08d435f68dfe6bfd4f5990779

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 1491ededb28ed5afb6b99a595fed1e2a32876e472b540ff14db28c52578e87e5
MD5 f876f9f96b86bc345f8268effb44f743
BLAKE2b-256 1302320ab702be6ff095bf6821e964034533b5cb4bb8ccebb34acc7fc8c6ea9b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.15-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 46b9690dec7dc09aa334f6518248bd27a3fffcacf99f0745cb42c98cc192ec89
MD5 c167620cdad13b49ebd19acac98be155
BLAKE2b-256 733f1d2a25e9539c3ca887f16f6b04a98656e92fc98ee217354e721a31454fe1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.15-cp314-cp314t-win32.whl
Algorithm Hash digest
SHA256 81ab194352781d55a6a7f259ba3f22c618bebd04a7f8e7eee65a0b91d7a6a137
MD5 9047a539f91e13e862af189525cba4c5
BLAKE2b-256 062e77d041c070ebb20226efe9bb5ec79eff7f176a64bc9cb9976509b03de1d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.15-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 f694a951e362a6a6649dbd3c92c6d92796295f1f49b1429f45704857c78a3198
MD5 0f4e0489cc3c419b48b15a1f41e2c7c3
BLAKE2b-256 60ac52310cfd79181789555f09a6d63da786e44b043a41c8967cbe1da424b617

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.15-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 daa2d4f168019b44195c67f0eb22094ec7e8fa8130843678f13974f5e8864c20
MD5 9f0a87840dde18ec9d287a07da4586a9
BLAKE2b-256 6b92801f5e6102ec879496e32a5ae5509eb4276443736613aceae4027775165f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.15-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f14f5c764f51ceca74bcb503bd4bb3cddb01b87f86d9286fc0d2dcc496e55b63
MD5 c0e0452aae1436326a976faaed3751b2
BLAKE2b-256 d769455d4307ec0b56a59f0636589fa45cf3285ad98b2b6b419ea24f89dc9584

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.15-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 1a0e3d1e248ea2c84546a63ce5afe3f26f00f5c467bc080bf10bc5296f6f2a7b
MD5 9433c3257b0074de075c215e51f38b14
BLAKE2b-256 89839f52a8c35b766e8eb960f06c388a7cc26d2cbcfc419d26b4a0ceddd38c64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.15-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6913610490c5a9615a141bfe24d29a85f223b0d94f12e0c93e231145117f4f7d
MD5 7299331ff731ada3577de252e73f28f2
BLAKE2b-256 08153d2fe8d11dbcaaa0c36704f8207729089ec1e1ba0a4c13135cd3ca59cb6c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.15-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 f1bb187fc44aaa1061af1b3f5a7dcd16fe3bf5c2248125e872b0c254379e87da
MD5 2596851e45e6e6ab365f90405f995cd8
BLAKE2b-256 cefac0c31c8fb8341fde0cefcfd7fd6a778cb70f742a25502ef97bd7f9803be9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.15-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0c976c6bc113595247f60e1f3f37bb900edf60c1f783bededce07706419141df
MD5 4a986b1bef1b4f65d8de052f43d8163d
BLAKE2b-256 7f430c72ca91f9281e1eadd168a0cfc19f5ce873bf70aa03b4d8fb655bb73193

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.15-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 8fa85a3a28bc24b7871225c14d8035699dd5b10cb1983fd3e0364260e2ed0142
MD5 2ae37f39d795fc1bdce02455a9a31fb8
BLAKE2b-256 4796580fdf11ad762ed874976af9aead9a7bfda6a3499ee571690849ed5f1f61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.15-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 16f58d3cb8192ca588015358eb9f7293f3e29af7bd74f89dd27fc8435f8235a1
MD5 638578fe4824ec17d487e146b7a77670
BLAKE2b-256 591f1ba92e5d4abf09ac9757cd7ac3dcdca4e996892d63a069c947253862ffa2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.15-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 3828ffd513de2698f55fe982a8897d7703b952b3912ee9725de8cfb3a5fe51da
MD5 b4392eb1f6507ac7d4f00e82a4c0cdbb
BLAKE2b-256 e639ac7d29d951f44bdbab522fa672e441a11f34cc453ac800aa4df71a9d9cbd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.15-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 151a404408b764a3017575f1634ecf487a5ce7a68055722d9aca80085fcca326
MD5 14a26d1c22af1b262e287ac1835dd641
BLAKE2b-256 e16cd59eae28f47b6339d7428b518eb2c2c18d27030e2a8eea67847582959503

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.15-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.15-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 1ca8abfa81513f4a836e4e5aef052166ef9f4fa8d00ec86e3971e1f96a2ed62c
MD5 3332e0fd4ec028f1e93aceca1ecd050d
BLAKE2b-256 a2f3ede20d359649292eb6fc8dafc70ae2d4c3212e18dc4c2709e09b29767703

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