Skip to main content

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

Reason this release was yanked:

Streaming functions are broken

Project description

XPyCode

Python 3.10+ 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.10 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"
    

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.0 - 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.4.tar.gz (64.9 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.4-py3-none-any.whl (65.1 MB view details)

Uploaded Python 3

xpycode_master-0.1.4-cp314-cp314t-win_amd64.whl (26.5 MB view details)

Uploaded CPython 3.14tWindows x86-64

xpycode_master-0.1.4-cp314-cp314t-win32.whl (26.2 MB view details)

Uploaded CPython 3.14tWindows x86

xpycode_master-0.1.4-cp314-cp314-win_amd64.whl (26.2 MB view details)

Uploaded CPython 3.14Windows x86-64

xpycode_master-0.1.4-cp314-cp314-win32.whl (25.9 MB view details)

Uploaded CPython 3.14Windows x86

xpycode_master-0.1.4-cp313-cp313-win_amd64.whl (25.6 MB view details)

Uploaded CPython 3.13Windows x86-64

xpycode_master-0.1.4-cp313-cp313-win32.whl (25.3 MB view details)

Uploaded CPython 3.13Windows x86

xpycode_master-0.1.4-cp312-cp312-win_amd64.whl (25.6 MB view details)

Uploaded CPython 3.12Windows x86-64

xpycode_master-0.1.4-cp312-cp312-win32.whl (25.3 MB view details)

Uploaded CPython 3.12Windows x86

xpycode_master-0.1.4-cp311-cp311-win_amd64.whl (25.6 MB view details)

Uploaded CPython 3.11Windows x86-64

xpycode_master-0.1.4-cp311-cp311-win32.whl (25.4 MB view details)

Uploaded CPython 3.11Windows x86

xpycode_master-0.1.4-cp310-cp310-win_amd64.whl (25.6 MB view details)

Uploaded CPython 3.10Windows x86-64

xpycode_master-0.1.4-cp310-cp310-win32.whl (25.4 MB view details)

Uploaded CPython 3.10Windows x86

File details

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

File metadata

  • Download URL: xpycode_master-0.1.4.tar.gz
  • Upload date:
  • Size: 64.9 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.4.tar.gz
Algorithm Hash digest
SHA256 e439b2ad6a1ed214f11f7f6c64c19aee025f4e674875996b11f1c89c9d97ad38
MD5 eba498322dfc73f19b781f86bdc141a4
BLAKE2b-256 3c8c2d1c9b118b4391764486447961b6048213fee7349af34a5002add144c559

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 65.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for xpycode_master-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fd27e8e48761540f1bd4980390f617dcfdbd02364bf2259cc8650a0e044c4b42
MD5 251c4d2097362c09f2bb09daec940dc0
BLAKE2b-256 77c1a582d334eb6c1950a15634ce69abfd8182d2558684421ccf71acdb71f528

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.4-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 dccc39a9864f0889eb866164d5eaf1affb0dfab5ab931fa4b98584e504a69572
MD5 ac9d5caa8bc604d1cfe1054e2176dc6d
BLAKE2b-256 4d462135f3b82dff0276aacb58689e9e301e9d85d3e390859c3281460b431dff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.4-cp314-cp314t-win32.whl
Algorithm Hash digest
SHA256 7c3f9a5e06d64ca8bb14b6bed1d4a33b780313a03b00f365fee4be7416584b02
MD5 52d54747e316cf6de3515c73f148d2df
BLAKE2b-256 f66d5a88d71f07ea7e0c5c32bb24103a2e1131415c1de5e6eaf5e7f4074fb0f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.4-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 316b82e02a68a84556cffad41cb6571425270b3319e610cd6b5253937e7ea16e
MD5 6ca4dd2fed766dcb3920e74305b3cc65
BLAKE2b-256 a046f79215015e0068ffcef3fbb637ab62326788413c213460170bea980b969d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.4-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 73dfdb29ed26cba7fa6143ddc64a62fcd37d207235cdebcda77850ea3bb1c1d9
MD5 caf6a366ff3dc2d04468ce6f049a19a8
BLAKE2b-256 5d48b1fe9c63900ab69ff143ba3a643fdd8fa37208c7059f151a7637fe75b78d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 76d981312fab4b39996e51736dc49a513bdf0ce733f03f632330959d02d18fea
MD5 5fb562fe2b539048f9b81191adef1947
BLAKE2b-256 05cbfd068e2dcadf721850dbdeadba4f4524353e9a2b3690bcda1d6701b9021e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.4-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 546d0e0224aaa193a4be33a94e21935e161bb0b33917291f3788b5ab086eef5e
MD5 ef23507834821b304e6683f9e99fba68
BLAKE2b-256 bcee233ff7426b934988834c344b33a3ef749f1a331106f63ff1ab78d4c6db99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e7ea5a6449eb789d3528d681dc533be3bca24712ad3e1ae5cb8d9b27e047c756
MD5 7b7930754e5596bba4806fb813b9957b
BLAKE2b-256 8e4436ffd66ae75eed3fe1e89c5a482ace2249c837df4885f32d977797df4925

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.4-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 50c361a5e818ebdcc138b4dd503aaeebbe1b6ddcc918849cef85e45ba3ed10c0
MD5 8eee48257105ec28f584bd6fef41afbb
BLAKE2b-256 e4bd74a229b43ffd808e42da1231135a89f10adde7bbb852fb81b6db755e6372

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5de2a993f5d90a2475a6d57c3266ca2e2d407316e5cd68dcbb4446d4063a381d
MD5 6e0606a175ecbb847ebcef31d0503e56
BLAKE2b-256 c97594f60107755d44ef80caea7ab7f200dab7afa21e5612e6bc166c20d985c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.4-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 623488e0c2165f4987f8e5ad98fe8e9f3c94fdc4faf74d9836e838da55e71a49
MD5 1f932d9bf39f6454cd8360aa8eee3a36
BLAKE2b-256 425f22c7aa3e825675c3f0ee7d40506cf2a13976d5d2b402c4cc9a0927671fc5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 90656cb4d6bd210ae6be6901698346757e69199ee71f370cc497a18e4c629545
MD5 55994ffde98e092162ec044fe5501070
BLAKE2b-256 bd3b7f0218a8d7bc307d67a2b3ef23fdc1fb9aca3f6a27c787eb01dca37d3e66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.4-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 c6b3e6a2cd5cdd2a84ad9d9daeccbc3eccc367e19ce9ec9e8f7a04b24a9c0b85
MD5 ad3a3df0bbabaa057200cead0a1a6179
BLAKE2b-256 be65aa81c961a2b703b04e25d050cdd74de595057e38337e653d97d28ca0f954

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