Skip to main content

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

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)

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"
    

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

Uploaded Python 3

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

Uploaded CPython 3.14tWindows x86-64

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

Uploaded CPython 3.14tWindows x86

xpycode_master-0.1.1-cp314-cp314-win_amd64.whl (26.1 MB view details)

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14Windows x86

xpycode_master-0.1.1-cp313-cp313-win_amd64.whl (25.5 MB view details)

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

xpycode_master-0.1.1-cp312-cp312-win_amd64.whl (25.5 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

File details

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

File metadata

  • Download URL: xpycode_master-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 e6a657c3e25e51c898db54fdac7ce841f315947b7043780d5463f5dbed5637c9
MD5 773ef8b5a54601a3c71b14d8b75624bf
BLAKE2b-256 a5ce975b8c95e7a72e06b004d90a38209c82c7ec4a03dc64ef8c31f724fe4976

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 982b0c5a8e8adce60c22ac986c7e37c84ffd769f8de00538873bf7dbccfa95b3
MD5 e8ed9c5db1249babb091cf243067baee
BLAKE2b-256 d6b704e75a4b7009a200983898ea38229ed169b0f3a2ddd5148ef7926ec1cdcd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.1-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 4fbf7d552ddbb8db9dfbfcb31d78a6bf14e4578fad29cc9a9d99030d2a66d212
MD5 c28bbdfb841e2a8ce266ac8c87746a4b
BLAKE2b-256 2c2ce852843979be0267bde81ac8c494cef951a9f8720410b80b262946407b14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.1-cp314-cp314t-win32.whl
Algorithm Hash digest
SHA256 ff27aa135663d7f31cb2bb597ea373cdffd4521633852e0ffcda91e1ec848ab9
MD5 f091ece4375c0a42b2e05407fadf4fe2
BLAKE2b-256 55f0e18c6c1a486b0b21cc871c8ab670dbf5e421f493508e1e179af99d3452aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 1c59b7d93ccee1504607ae47f1285981ce5da0e7018f0de14b148ea28c670e87
MD5 260db0b433e6f86f7bbaab33f0cc67bc
BLAKE2b-256 03a9750c21075efa5a6a5fc0fb0a40b07f3e2820acddaa6a63554f681380cb90

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.1-cp314-cp314-win32.whl
  • Upload date:
  • Size: 25.9 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.1-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 0be5dba990822b4dcd2413d9f712b0903f9d9f07bbd43ee77475fe71289185e7
MD5 1f3cae03129c550aaf0800ac04b5a796
BLAKE2b-256 7f566bbad0b56f24460a8fe600e13206678b2b49a65b76f4fb259b86ba59c01c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 384f186c26b969017891f3225fe4875e9250ad7e2de936dbcdf5d1c2d31de445
MD5 e53ba9beb5164679f161bfb345964a10
BLAKE2b-256 9fba2dbb4981879d8f2a81ad203be4b301d01a1f460b6607c93505f7b2645453

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.1-cp313-cp313-win32.whl
  • Upload date:
  • Size: 25.3 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.1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 105115ff27902841c726ecc728c31aad876aeba9558fba88dacd0ec7a3d242b5
MD5 b6031847e23d278f6a51632084da308a
BLAKE2b-256 0f21f595978d16474561052c29909a036be62f9e6ee4df30d9f89253cad057e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5b77322eef8ad8bc08d0d49dc3e20e855d7652dafb2422321c56868c527c5743
MD5 81d227e3cf3ba1a04e7fb1b2622c364a
BLAKE2b-256 2d33b45d1488212de202556bdce8b34fe3886685bd482d6e8c7c731f5ae14461

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.1-cp312-cp312-win32.whl
  • Upload date:
  • Size: 25.3 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.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 962d76078f4123574ac4ec8a2eac4853d3640793639161e1904c7dfc08d10fb3
MD5 305162466a90cb54426fa79f0751d219
BLAKE2b-256 c4dd72adefabc9cda77f93350e3cd796c46bc42f92f527e062e58c7c992a8169

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 43a0fbfab93d0d783a20f206ebae2a8efe9a542a386a472c0af17ebfbc7b96b5
MD5 6b341f91a1427d1d891e0ce595faf423
BLAKE2b-256 ec5c7671bb4fce476293cad435e185e9a3644173153e18d705267c9c7e359987

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 25.4 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.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 f5c54a41bc2c380202e26eb9fb1b39990a46ae86e89459b94aabfc14b7c0ae44
MD5 0d2fab1593e2a18bda052e1351172493
BLAKE2b-256 49f7ec4b1b19897bf33290e140ae5bae49d433bbb9fd1a030133015af168bf65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b87ff6650748a1bd9411a9d1afe042479bc54390aa4e14f78b8a7008efdfa862
MD5 a47f41fce37b7aaf68f41ae808672456
BLAKE2b-256 cb97a605e59923559e47bfa598957b0967d691a7939c6a17366de1e33cf35526

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 25.4 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.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 2b9134dad311bc0ee7999e964c9162699b2462967823404fd3e541feaa0d143e
MD5 ae8e44f76f1d54feb9062b93dea2c0a8
BLAKE2b-256 3b112da23af7e4a68dc6fe3e42248ed8ff2f037f8ced73eaa1c1080cb8522833

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