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)

๐Ÿ’ฌ 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"
    

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

Uploaded Python 3

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

Uploaded CPython 3.14tWindows x86-64

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

Uploaded CPython 3.14tWindows x86

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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14Windows x86

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

File details

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

File metadata

  • Download URL: xpycode_master-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 25a05b53c9429dfc474e8c7d01e53dbe29c5c9c6fa154aa16fbb599b9e5361cc
MD5 44746baa0db04b7735ebf9c33df02c3f
BLAKE2b-256 b2b09e3be0d453dca277c5cead7f218316a59834687c3e994558ba0f47f1f18d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 edebccffa0244f4e51740c693d33dc4c23a685628e35b81c8f0e610e9a8dbabf
MD5 81c1255b1d1c0f77358423f5dea7aae0
BLAKE2b-256 6483fac4543734a60070be3bebf61ab03e0d3c2d4c0e3610305b547e804d5b7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.2-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 98a352f43b0011437274881ec6b5cd2132aef22a1e3966be34314d4aff0c1bb5
MD5 f9858bfbfc7c04f295e45c31f424d69f
BLAKE2b-256 64ef25f197ae3a8312113e2fff9ae245eb6e16b0be6f6f1677a73a1d1e6f7a58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.2-cp314-cp314t-win32.whl
Algorithm Hash digest
SHA256 6ced110e779fdd88f958e34ffa606209cca63710ea7b48d51e2eaea37abe7424
MD5 49e649abfb26ead77b62057b1bfd734e
BLAKE2b-256 f7cf597206e78b4ff7b47070deb8899e47ac86f41ba3b555b97913a7eb5ba0ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 e6781e67ac666f802e568e3cc0f37c8d216a9ca5cef16a383f5b3ad3b2a74d1a
MD5 8c47c0228714457eb5246240a54f09c6
BLAKE2b-256 c7d5cfccbe3c32ad368efe8479e888731e632224b8cfaf357dadc4e2d33fd516

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.2-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.2-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 c62a49cabfb0ea235547ae6c26e2c6053ccaae78d997442bb1e3690a32863b17
MD5 06991b55b063c7960fa8a7d11c50ceca
BLAKE2b-256 38b76160050f4acacea2a1461fa3596543fbd121f375f3526e1e4db888215e0a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 17655f0e079576a1c15967e85d6f8f60664a420a52adedf5adfd42e76d2886d7
MD5 c24498f16ed98f7762c57e296445d167
BLAKE2b-256 a7fcc57145293f35af667bf57d339a672da20736043115ce5a1ad5fb3f411774

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.2-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.2-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 db6846f5ffd0031b6d79e0f498091b7ab264e8650e61d3b63fdcfb249c91704b
MD5 7a70ebddd69272aa1e943e4eef5576d5
BLAKE2b-256 69d61b0feaf115dd32f4e87cce53c7d59963bb0d0575b798426c465eb86541ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0834a844a0b21bb0dd234a1e649591be7bbfc75ca826de7574a682271691e3b4
MD5 2e5b5a916fa640aae30ede5eb009d1a2
BLAKE2b-256 397561f10dd4896f274b0dd8a1d0a5891a84f1c4b4274b9612435e8985961be2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.2-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.2-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 fe55ef737beb7063bfb3fbf79ad977402dfeb4f6cfc553034793e31dba8954fd
MD5 60dda1b7ef1e8272b5d150049e2ac17b
BLAKE2b-256 316835ce411c64166d05b6cc28e02ef09dacaba0a1c85882bc4d4d56e83f1507

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f5d59d3b1f045ac42cc1aa6f61842755b17454ba977c15db3671c50f858ec9a9
MD5 b72e89f9cb80fd60774c67ad3eedf0a9
BLAKE2b-256 c9006d9ad57c385c2c8695b66cea8df15d49a15453bec5015f44b2b608935923

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.2-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.2-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 0b09b543ddc322b73befaf63c05eb5eda8f768b16a5bb052dd60a4da5e657d66
MD5 9e324989b972d881c7f06e08eb06a19c
BLAKE2b-256 7ede52bb100ec197a24683d7bf2f0fe2f72ba34435a1bbb586a1bcaad539bac3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xpycode_master-0.1.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4290926f3349ad8d9c35da33aaad20d877600dacefafac48785cfda895d6cd5c
MD5 813fb6f8338a8665ed8b63a73ecf32da
BLAKE2b-256 756c8f9ee0db475a6287509445208c48a039feac3350ae303366535ca3140154

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xpycode_master-0.1.2-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.2-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 04a874a71579b68456046455e1e4ddae91db4e8ab866e39974d0ece12743eb9a
MD5 2179c53ada60c0b194491dc87310fd5d
BLAKE2b-256 fdee9d176bff73729c93cd5a112d77af4d4f1c93da829d561f10ddae781f7a83

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