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

Uploaded Python 3

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

Uploaded CPython 3.14tWindows x86-64

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

Uploaded CPython 3.14tWindows x86

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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14Windows x86

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

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

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9Windows x86

File details

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

File metadata

  • Download URL: xpycode_master-0.1.14.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.14.tar.gz
Algorithm Hash digest
SHA256 0205a60198347421e7c4dd2ebf19c704ec638220df1399c9a98f286f8c319232
MD5 c14fd911b9c7735086f71fe2dc1abaaf
BLAKE2b-256 4c5c8796394d3287fb90c851885a3c1e32732f948d9c6e1b0b08832bcc685fb2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 d938359d4ad391db00fab9b47c0e0599fee00ef01e8f5284ec915b7a3c749b15
MD5 67e1c2bc1900943f5f62d052f31be6f7
BLAKE2b-256 e751bca906f52daaaa181aef76e6e879ed822c13f74f9bae5455637b5b9d73a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.14-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 7f5ced11978469b36a7b780dc4b505635dc3f1691d244232570e3b3193ef6e76
MD5 3392f608b1eb781fe20aaa3c77ab689a
BLAKE2b-256 2bba9547a79b061c20609cb38818b4fb8b0e56c44cc2bd810ba3b6c8e2893a09

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.14-cp314-cp314t-win32.whl
Algorithm Hash digest
SHA256 c72ea96590ad286c10ecc3ea501e522d8a9c5566b4df55bd790f36882728674b
MD5 3c4ed2bb2177fcb9c4a6d8d34c279bc0
BLAKE2b-256 a03e1ca250ff6692669dabfa42b68e4d1ab60bc5524c17457863cd6184f12a17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.14-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 49915fd8090f87c2e91bafead6812aada96912747403bf58b379ab124129dead
MD5 e5cee67a1ff2a3e47d9322c5d5a53b35
BLAKE2b-256 b51047ef6111b1d9dc170a99a05d1644d15a32a37de9107bd77369c02aa15040

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.14-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 3706dba8f2fa9d8eeebe326ef8ee6da6f1518f8de8979f0e1a826d7270f90417
MD5 0a2b9bd38c2f80582f047b8f88dfbc4f
BLAKE2b-256 7da7b035b5dadda33539bb54292b06c2d2ea66f5b288f641bde5c9d02d47d68a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.14-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d3021c07ae8344136e7dd1748b3e3d6bebeacb0ae5a1761e676bf60ccc41563f
MD5 f89e29ce362255f12a0f87462490c908
BLAKE2b-256 03a71f42a64548120a7d8aa85b6ce5cf049bcd089ec32fe911dd4912ea6d1c12

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.14-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 464c6e56a58dedaa4c7429d7e74300c02ddfda4c016e42c72a08c1af22315b66
MD5 715579dc0904a4052163f972989627a1
BLAKE2b-256 206b933efda173b61fa8bd5c6757299ccaf1b5eeff2f3e5a8c768f89ae23c307

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.14-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 24a4a2a2f0255477d06e624912b876a1a9ec56c6d2fa020f355952fb6df2fc99
MD5 5c795a0871d00dd576559ad74a084994
BLAKE2b-256 c15241f0e975b18ba35469049cd968ef22c0de84fbe970b1b14e4ea5552ad169

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.14-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 136ba880ea5d9d2fca1141a0012c1c0c711ee73d07b67051424e667c65ac38b1
MD5 289cb1620f5824a9b2ee881d1fa7f058
BLAKE2b-256 c09c348f6308a9bce0fc1ce3ab38768f138ebf8eca6a36cb1b392feee63c22b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.14-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 37a84683de29411e3153f793f79dc1b2d99211feac93cf3fb7912f46a6776ea5
MD5 0562bd97f5db7d988b858cb095e265d4
BLAKE2b-256 f9f63b3ca7ed8a68b5b9e55d592eabe14350a1d11541c54f07b3df21fc44faf1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.14-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 b88a9338b418bd323836ce09b41750f9dd1dd3ad17f47aa03da78ba0d9cd9378
MD5 f70274cee0abd9523d0572f9a68a161f
BLAKE2b-256 b7de821c44561313c50dc834df4e655cd022ce9cc7e287f4c64163b5076a85da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.14-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c40e1fdb5c2764a2045760c04b22b3a6c5221645acbf5867f698730d7769a73b
MD5 0e88f4980c1c8fd3bea2bae90e0abc04
BLAKE2b-256 11d9b3432517948adf10b9edddc31b0e65e7f1ca11db71bed276350b572b7fc4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.14-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 68d62d9b36da6a8c1ebbd0ff9f143d7cd9c00eb89cdb9e16c899048fc2f1a469
MD5 9f456c5979e0529e792e71109e8f76c4
BLAKE2b-256 dd5c50a48eac99ac0ca0330fb2ad1728f4daf7d110e7da6176304d6463d3dd34

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.14-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 65eec10632da8b3168d78d6afa8b1fabcdd0425774aeb6d3796b0d4945d3ee7f
MD5 54be33e3be87f92279bbf459a8a1f08a
BLAKE2b-256 12f3e6ceb11b3d4160f46835cbca92e014e91402974362b6b5447202c554ce4c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.14-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.14-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 74e006635a1b55ee36ca43e1337d1521fe1db5afec050addc0870e635185d920
MD5 367e722100913ba2e175bcde40832dd3
BLAKE2b-256 757a841b864fbf2c05fd69f72cdcf0f88932e66eee13ca8b80a90fffe8823cef

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