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.18.tar.gz (67.5 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.18-py3-none-any.whl (67.5 MB view details)

Uploaded Python 3

xpycode_master-0.1.18-cp314-cp314t-win_amd64.whl (28.9 MB view details)

Uploaded CPython 3.14tWindows x86-64

xpycode_master-0.1.18-cp314-cp314t-win32.whl (28.5 MB view details)

Uploaded CPython 3.14tWindows x86

xpycode_master-0.1.18-cp314-cp314-win_amd64.whl (28.5 MB view details)

Uploaded CPython 3.14Windows x86-64

xpycode_master-0.1.18-cp314-cp314-win32.whl (28.3 MB view details)

Uploaded CPython 3.14Windows x86

xpycode_master-0.1.18-cp313-cp313-win_amd64.whl (27.9 MB view details)

Uploaded CPython 3.13Windows x86-64

xpycode_master-0.1.18-cp313-cp313-win32.whl (27.7 MB view details)

Uploaded CPython 3.13Windows x86

xpycode_master-0.1.18-cp312-cp312-win_amd64.whl (27.9 MB view details)

Uploaded CPython 3.12Windows x86-64

xpycode_master-0.1.18-cp312-cp312-win32.whl (27.7 MB view details)

Uploaded CPython 3.12Windows x86

xpycode_master-0.1.18-cp311-cp311-win_amd64.whl (28.0 MB view details)

Uploaded CPython 3.11Windows x86-64

xpycode_master-0.1.18-cp311-cp311-win32.whl (27.8 MB view details)

Uploaded CPython 3.11Windows x86

xpycode_master-0.1.18-cp310-cp310-win_amd64.whl (28.0 MB view details)

Uploaded CPython 3.10Windows x86-64

xpycode_master-0.1.18-cp310-cp310-win32.whl (27.8 MB view details)

Uploaded CPython 3.10Windows x86

xpycode_master-0.1.18-cp39-cp39-win_amd64.whl (28.0 MB view details)

Uploaded CPython 3.9Windows x86-64

xpycode_master-0.1.18-cp39-cp39-win32.whl (27.8 MB view details)

Uploaded CPython 3.9Windows x86

File details

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

File metadata

  • Download URL: xpycode_master-0.1.18.tar.gz
  • Upload date:
  • Size: 67.5 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.18.tar.gz
Algorithm Hash digest
SHA256 1e4dee904e972b6d2ca28fc49957819f4420b28b880777222c272e57e7ce49a0
MD5 dc4fad2b16844e07c0ed586dd23ef6fe
BLAKE2b-256 28fbcf0579a314276e65f2cf5f83f418e0254a62e2286c58fe4f594508d7a372

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.18-py3-none-any.whl
Algorithm Hash digest
SHA256 cbac8e30b9f2b5a00d0a06cfdf6f13d34d6a5b1069e618bbe96fd5a8240354ba
MD5 304c203815df8eafd31986742ea2247f
BLAKE2b-256 1cf8c745d037c388037e991c2680ebeb8186e6a58342f7d4a3c34b7e4d22b9dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.18-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 ac5e41817b8c1c80527536c8c03f8d635a4652c88ef2cec9abdfe5801ef61b27
MD5 a7121ac9a08d1f87559c55d48059c9a3
BLAKE2b-256 b43fecf42bc4a8053cc010f92afcbb29073760f5de5eb9497238e989045bfbba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.18-cp314-cp314t-win32.whl
Algorithm Hash digest
SHA256 19856dc0c458f0f539dd6230ebd9e7b085f1fb30da6a373fa7dc425a99339e03
MD5 c36bdf50fc9811a7529ac69e23b60f8d
BLAKE2b-256 be0278e8c81983ec1b7902e991b7a1b1f5100d010f28391178714f1db85e37c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.18-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 733cd4831e39e28c551446ee66e7eba0e25629443e3dae9a3da1475c64f7f31d
MD5 3c8bb5a8dd641aa9b7e5b915ce66b466
BLAKE2b-256 9523e6c5c6c780f31f194dc108432263a52dc57235bcf8fc3490c4e1862f3a74

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.18-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 d9bb1bc514d86ffded05e873f0fbbe496676325d39be9fff05b11ac729536714
MD5 4cf47056ccd471cb5734a1314e4ec830
BLAKE2b-256 eeb73e3ebc39a343873b64c8374f61df45461cd98222e6d75f732b57fd95a1cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.18-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 73178d44e2bbea2c321b0a4be734a64896704dafe0b5024ae3b730e8e17cc516
MD5 9c2934c81ba998059883483fd26877b6
BLAKE2b-256 72a9a28dc95a460eeab9971f429f26a49f1c8b4c002cbf890890489a75a444a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.18-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 386bd14c6c629ffe557624f78cbf493d94528fc16870a39b11b78b9cb4ed760f
MD5 e479d1b01a9a3f1774ba295e3fcdcdb9
BLAKE2b-256 d021494d569860b195f717bb5337d269951b6b736dd8d9c864a9a9bd4528d95a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.18-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 562ae688d4b7bb9be9efcdde8a82d82d94eab3fbf19a1fd7684686c7642af94a
MD5 bff66e9fbb2c1da7e1f0a92cf8ae1266
BLAKE2b-256 27f9f9be7013d6187ea780342f0892684ef1ab61ab8d9017621c59992aae2640

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.18-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 d0ad5a82a95e1221304109e8823312c5d1f8064285def726d70d8ada082d2f0e
MD5 d9af6f4ca5bb5ad44d7d94428fbc7bd5
BLAKE2b-256 130632e3f77f5df6601002cb2f78db1b22ca57245706fa7c6fd9641f113be4c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.18-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7a42245590c0ec89a0cb95a1e474a009609c8a1bb51f9a28ab70dec006dbdf44
MD5 407ec2fb82151b97dad0b73b39f7a323
BLAKE2b-256 84eae29f05f7e562c5ae8022a45712b579f09ab2efe8c57e8212a2a576416652

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.18-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 0c6ff2a5089ce3feca0b1d9c9e5011ffaef17e16f4a99c22a935c25af47c20f1
MD5 2df2b0e04f14a72bfa6317444b8a478e
BLAKE2b-256 9383c3737553e97512bba26728291f9ca59e5afefcc27ca0ff7013e0761bd178

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.18-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 45f5ec9f1b2af1c01e00c1861f87b60a514e456281c2787d6100cac2ed7b7dde
MD5 411c1fe1f26dccdcbb5c3e13dd0a82ab
BLAKE2b-256 b13bd9e8d7502a4f6f2eaaa616033d912d00e0fb8f068efb02bf7e7574b1f1a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.18-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 4c2ff1eebec176b1de6bb64104b762c1dbefd4fc638580bbd8b0ee926f29b86c
MD5 b3ec57276d5acd3f1ba8360e96840839
BLAKE2b-256 53062a9148e14b4e3cbf4df0ee4b0db0c32d21317c9c5998b1179aad9396f702

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.18-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 5bcacfcbe2e2885661b93caaf731f689e7b7778bafe9932c0da759686d510487
MD5 4b765f0d12918055ccbf1b30d62c5c09
BLAKE2b-256 fb04f3df997f5e0fb798d339a7fbec9c01409fec80ee44096f56807807736fa2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.18-cp39-cp39-win32.whl
  • Upload date:
  • Size: 27.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.18-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 75efaae46bb08b6adc987863478f70f65338a82361483f91025fb3ce5bc76d84
MD5 3272f4131800ad60dfafdfea7c0331d5
BLAKE2b-256 a3f723c205eb2d8df8048c07b839b8b4b05ec3c94d4d6563649d85e186934d32

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