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

Uploaded Python 3

xpycode_master-0.1.7-cp314-cp314t-win_amd64.whl (26.7 MB view details)

Uploaded CPython 3.14tWindows x86-64

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

Uploaded CPython 3.14tWindows x86

xpycode_master-0.1.7-cp314-cp314-win_amd64.whl (26.4 MB view details)

Uploaded CPython 3.14Windows x86-64

xpycode_master-0.1.7-cp314-cp314-win32.whl (26.1 MB view details)

Uploaded CPython 3.14Windows x86

xpycode_master-0.1.7-cp313-cp313-win_amd64.whl (25.8 MB view details)

Uploaded CPython 3.13Windows x86-64

xpycode_master-0.1.7-cp313-cp313-win32.whl (25.5 MB view details)

Uploaded CPython 3.13Windows x86

xpycode_master-0.1.7-cp312-cp312-win_amd64.whl (25.8 MB view details)

Uploaded CPython 3.12Windows x86-64

xpycode_master-0.1.7-cp312-cp312-win32.whl (25.5 MB view details)

Uploaded CPython 3.12Windows x86

xpycode_master-0.1.7-cp311-cp311-win_amd64.whl (25.8 MB view details)

Uploaded CPython 3.11Windows x86-64

xpycode_master-0.1.7-cp311-cp311-win32.whl (25.6 MB view details)

Uploaded CPython 3.11Windows x86

xpycode_master-0.1.7-cp310-cp310-win_amd64.whl (25.8 MB view details)

Uploaded CPython 3.10Windows x86-64

xpycode_master-0.1.7-cp310-cp310-win32.whl (25.6 MB view details)

Uploaded CPython 3.10Windows x86

xpycode_master-0.1.7-cp39-cp39-win_amd64.whl (25.8 MB view details)

Uploaded CPython 3.9Windows x86-64

xpycode_master-0.1.7-cp39-cp39-win32.whl (25.6 MB view details)

Uploaded CPython 3.9Windows x86

File details

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

File metadata

  • Download URL: xpycode_master-0.1.7.tar.gz
  • Upload date:
  • Size: 65.1 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.7.tar.gz
Algorithm Hash digest
SHA256 006a1ae51180ce08f1f60d346f5ec2df7041a6b8421cdcd25049b1483d19bbd1
MD5 782401086d4e47ba6eebcac8092cb548
BLAKE2b-256 0b9c8e12bfd14a7761dca98e384bbb3bc933bdde32a998a011b03aa9c84b2eaa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 65.3 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 42358627a1be574e84d37c87b976c034caeac98f5721bcf7c9925efc8ea67f5b
MD5 c698a170d4fd2a2f34ce5f99d9752830
BLAKE2b-256 592cef5bbcd8b0b90a2594246ecb5940b60d14cfd3c72168e2c62c7cc163d312

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.7-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 21c2f155a3291e21d05c3da0e7405b7c500efdb1ea0271912290ce76b318b17e
MD5 dd812b60a83d398974a2e5f1e29e30e2
BLAKE2b-256 1e8d3e936374ff19349c28c13becedb51156b555784127aec7c3cd1f0b8c547c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.7-cp314-cp314t-win32.whl
Algorithm Hash digest
SHA256 41de3581b2f17689e65796ebb95b25982288a90cbf357f39a77743721fad63b9
MD5 f42acb3853038568f4c4d7b55d9504a1
BLAKE2b-256 9b5253211ee16396ea7ac71e0f89b80233f3b2d5bf1fd35bd3ff7fd79a91fe63

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.7-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 60640bc1e12733907179f276a399d059a603006d12ac1a613a96c6d1b5982d56
MD5 6f37526af565d215bc5d2f4bff0786ba
BLAKE2b-256 79fb22e6fddcf5d6fa49066582ad5c73de7a8a8133805c6e6a24ab553e10fb59

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.7-cp314-cp314-win32.whl
  • Upload date:
  • Size: 26.1 MB
  • Tags: CPython 3.14, 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.7-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 3486db3a6cd5dd636e1d798fc71cf7a040dd76b452423e316473940035857666
MD5 112c5369b6ba09553eef428b5604bd38
BLAKE2b-256 3155f8384d07758a80244c2900aacaf47d6014ec6e316105f4f3f70f2b079e13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6992d6501e495fa908e32c8fe1ace540b55f32331dca6362165bd1fb5ce5f85f
MD5 4522322db47d24662e1c85432a466724
BLAKE2b-256 d87addb42542ba8db903285c2f0cca331c3fcacc64acd6ec6044532a7bc1e029

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.7-cp313-cp313-win32.whl
  • Upload date:
  • Size: 25.5 MB
  • Tags: CPython 3.13, 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.7-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 f54b27ad9b2b895b10dbde6aca6d256a58b2e5e3758d2c8a23d391874b6e6924
MD5 7c8d0c75da0f2db31a0c5482f29f9d6e
BLAKE2b-256 f6f775f22ea033543cbc0a0590ec94df54d222850fb5ccebf0da39fb6b518f14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 132372f3e86c40e39f61d3a245182e0d322d08228e58f7ab68cdee93221668dc
MD5 d32226c29e26f02a23ba14691a3bbcb9
BLAKE2b-256 5b0e1805d807105b17dcc1cc85fde9961796d35a7ce96093c5808cb2c3117175

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.7-cp312-cp312-win32.whl
  • Upload date:
  • Size: 25.5 MB
  • Tags: CPython 3.12, 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.7-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 34493e1fb62c01ab97f75f1e7de0faf293c1f6fba4343c3090406cdf9f15857d
MD5 05943e812cdf82176bb788fc7810053f
BLAKE2b-256 9c4cf6ca8457d99e7a4acde8b2aa4e84b49e19d5dd56f7ade15f6ef3d4b3228d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2f9d6c9004f1c43840fec61045de84a41f56a5f7cb3c080dcade377c3236c294
MD5 6a29d4bd463edf5c6e426bcc1c899f1b
BLAKE2b-256 4099a56e5a22b5e77ba7872d1774925dd0fe7b08c00787646ea8d7ee93718871

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.7-cp311-cp311-win32.whl
  • Upload date:
  • Size: 25.6 MB
  • Tags: CPython 3.11, 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.7-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 6a8d31ecf3ffd383e0f0df35ba36fc4d2e447f489ca20aee39f3ba86b16ff9a8
MD5 6f4cdeb965233c21706e3e5365e993d0
BLAKE2b-256 299503daa2a58821ed8dcd31850525060d4679acc96713249cc136e74ca8c42e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0f3651eafef658e90578b20bae084eba54c775527a883e6e2b4537a5532daeca
MD5 cde3929789e47b5acfd9ed0ee3260f94
BLAKE2b-256 6361a795697f1c8f062195d9886bc5d5b96fea668dcfabac91b02825d910a509

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.7-cp310-cp310-win32.whl
  • Upload date:
  • Size: 25.6 MB
  • Tags: CPython 3.10, 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.7-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 59f3d413888d5d0794ed38c17f991335dc2962bc7e193483d07fbfb6fd7a060e
MD5 709dab0f31ec8329032a5bf888a8f92b
BLAKE2b-256 6c8ab1fffa966db610dafc39d1979c8dc4dfe8b7758bddcc7783b78907d3f4e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.7-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 d6bd2a418d25ffc6c1561dbb989602da62a06378fdacbf22015a07a50b2654a5
MD5 b45c1d4f5167f4a422c5eab8c3508ab8
BLAKE2b-256 524527c73eca2922a9a9012e72086aa583a07b91e0bc488bb381b37bfd40aa5c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.7-cp39-cp39-win32.whl
  • Upload date:
  • Size: 25.6 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.7-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 045ce8d810db93fd3f02f1ce1c63b60cb97182a8689c1470e13e38324e07c52e
MD5 96295a37eaa969a85da235133eb0aab8
BLAKE2b-256 e64ad68868278f25d07d933efb7343e5c06d797c9f8fc75f08beaf1c80ba17e4

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