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: macOS Platform: Linux (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 a Beta version.

๐Ÿšจ 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 XPyCode Master:

    • For a one-shot test run:
      python -m xpycode_master
      
    • For recurring usage:
      python -m xpycode_master --setup
      
  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"
    

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

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

Uploaded Python 3

xpycode_master-0.2.1-cp314-cp314t-win_amd64.whl (11.3 MB view details)

Uploaded CPython 3.14tWindows x86-64

xpycode_master-0.2.1-cp314-cp314t-win32.whl (11.0 MB view details)

Uploaded CPython 3.14tWindows x86

xpycode_master-0.2.1-cp314-cp314-win_amd64.whl (11.0 MB view details)

Uploaded CPython 3.14Windows x86-64

xpycode_master-0.2.1-cp314-cp314-win32.whl (10.8 MB view details)

Uploaded CPython 3.14Windows x86

xpycode_master-0.2.1-cp313-cp313-win_amd64.whl (11.0 MB view details)

Uploaded CPython 3.13Windows x86-64

xpycode_master-0.2.1-cp313-cp313-win32.whl (10.8 MB view details)

Uploaded CPython 3.13Windows x86

xpycode_master-0.2.1-cp312-cp312-win_amd64.whl (11.0 MB view details)

Uploaded CPython 3.12Windows x86-64

xpycode_master-0.2.1-cp312-cp312-win32.whl (10.8 MB view details)

Uploaded CPython 3.12Windows x86

xpycode_master-0.2.1-cp311-cp311-win_amd64.whl (11.1 MB view details)

Uploaded CPython 3.11Windows x86-64

xpycode_master-0.2.1-cp311-cp311-win32.whl (10.8 MB view details)

Uploaded CPython 3.11Windows x86

xpycode_master-0.2.1-cp310-cp310-win_amd64.whl (11.1 MB view details)

Uploaded CPython 3.10Windows x86-64

xpycode_master-0.2.1-cp310-cp310-win32.whl (10.8 MB view details)

Uploaded CPython 3.10Windows x86

xpycode_master-0.2.1-cp39-cp39-win_amd64.whl (11.1 MB view details)

Uploaded CPython 3.9Windows x86-64

xpycode_master-0.2.1-cp39-cp39-win32.whl (10.8 MB view details)

Uploaded CPython 3.9Windows x86

File details

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

File metadata

  • Download URL: xpycode_master-0.2.1.tar.gz
  • Upload date:
  • Size: 9.7 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.2.1.tar.gz
Algorithm Hash digest
SHA256 b23a0aa06af4c1deb9e04cbebf63e07fa3cc8be5893a78d57850adc2fb4843ef
MD5 42c1dd4729d4c4c39eff7ba77b6b1eff
BLAKE2b-256 edf146003231ab5f5f6da5aadb33bf5fbc7238e20073476f6099b3c82f6d33bb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 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.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b239a7fb317300da1433c901ee58f0ae80202034f35693b1c70e7379ac5e08ff
MD5 7ad16719716046576372b11a5afea421
BLAKE2b-256 507f6280c158ef76838e60e9d520f91d2ac21e8455e53a303400767b95ca1545

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.2.1-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 9aa643785e3345436aaccd27ab93fa43463c04bdd9fc37cbe6b948d7fc2aa2ba
MD5 c8bbadc798af1ce3717ec276b612d8fe
BLAKE2b-256 9461ed2db0cfd12c967a8276b8eab83dd19d9bb6f3faebb2c06296fe1d67f44e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.2.1-cp314-cp314t-win32.whl
Algorithm Hash digest
SHA256 377df9bd98b3e9d96ba17de1cb3b5fb38565bc8aad73f0020b54b6045b6326f0
MD5 4c6a90fe5b3f010ada529428adc236c7
BLAKE2b-256 aabc3cac70a5220e3d23bf355a2d777f163dda1e8f4096612c4ab634cbd87f78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.2.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 55400fdd3a9ac8008bca0aec1c7627685d8477aa7638f47d0d977ff67e6be71d
MD5 3940eb204606064827d3d2754a411b78
BLAKE2b-256 14f8a068c49b41f0d79446062cb3a5eacdd5b4f14df9a1384c495c07f5715114

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.2.1-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 dfc86db728d9cdb615a4e322cf5ceaa3b09ec14a7d4b225a9cc9bbc0eb5421b5
MD5 0c8aac6b666f2e504e3e223f266da71c
BLAKE2b-256 e6e72c56232789eb63abf1765f6abfcca4c49663f4b328f8eb7823c705310752

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.2.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1359ae2df224dfe5ae72cd6abc29d5c3e948a0e1dcffd57b9f520c0942dcb738
MD5 2b19f04e3ab213ecbb21b8ac1bbb26e1
BLAKE2b-256 ae018668f152be42d6bce8798ec07029c896149867ebaf222ca793caf2a2f96d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.2.1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 bfbe1f2d6f44fbd2c265ce65f67a36fcc88df6cc97972a2e5df558088d1abf61
MD5 749d5e696ab871f309484c4f7947ac55
BLAKE2b-256 ec9ce48345da3e827854c247ec5236bafd547ff9f1149211f9198eafbc9b2097

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.2.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1f4243d8976e7251cd8dd876162874e05e11c67046e175e5344bc5e8c49fdfbe
MD5 cb4fbf7fa84d4d62d3c3f3c1f2fcfd13
BLAKE2b-256 a30bd62f0826f0e1abce480e3bb1f60e671ed7a766393af03ae95a9e2f830770

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.2.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 0dae222dac578a6a7ec7638e799e15e4f461e7dc44648289e9e05d64d8eb3cfa
MD5 e60cd597ab222360e17193bf6bf78a2e
BLAKE2b-256 ab196834420023fab93cc45f7f41f8d6c40f75a7f73c577218fea19bc176c07d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.2.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e18572dce031b4ce99a93e9c8d74ede1aa23c264a490fe0aadc872a9986e466f
MD5 057d5344605523b18f82a617ba95a461
BLAKE2b-256 eb7c224e18b7864c9097ca42a3d0a32b2c70c2c88e76c55a8b95936219ff7c30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.2.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 966089be966fb3203a59cbd8216779923c7c8c65cb169805dce50a9d68723907
MD5 33fe8c4e83073ee6f53ac98a0378c8f1
BLAKE2b-256 03f3f9dac5fb0ed77cf0f4bde0c371cda13c5c57f0d03cb9390bce7faa978cf7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.2.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2d8a4ea4d2628965befa5d069d39d202f70611b23b8557ed384305fe5233348c
MD5 f25134ab642a405c3dbe134591082074
BLAKE2b-256 491bcca7a105706637269b7e7b160d7c9c858742c91912a3e4d86ac0f3a4fbe7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.2.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 4aa879a0e4a436cc368a4a111de2ca818b2ade0b1dfce8868769f25a53f9dd5f
MD5 d7b1569013d20262d13251dd22ce84b6
BLAKE2b-256 bf116f77bb9866f630f04d8d8ab31816121d31bd18c267e58168a92df3abeacb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.2.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 a26a22f201fae18d6dedf5e388f909b38d862a4b182ee378c410fbd9fdd75be5
MD5 91baf7b99c1002baf1ab8874bf2b69f8
BLAKE2b-256 861cb01a27f3c3599019b9fe2b1059140b531207edcb6a6ffef6d9769f43f46d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.2.1-cp39-cp39-win32.whl
  • Upload date:
  • Size: 10.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.2.1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 2cd51b96aab7cdd07db27813c12975f842fe6dd1420afce1056f82b7dc51bdd4
MD5 4c0226840c4034a77f0e34764701e393
BLAKE2b-256 528017b7bf4dd308afece13ae993fb97d46e2d1cd2eac8f61b74bde3bbad4f8c

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