Reusable xlwings and pandas helpers for Excel automation workflows.
Project description
mgtx-xlwings-utils
Package-first xlwings and pandas helpers for Excel automation workflows at MeiraGTx.
Install
pip install mgtx-xlwings-utils
# With Benchling integration:
pip install "mgtx-xlwings-utils[benchling]"
For local development (editable install with test + build tooling):
pip install -e ".[dev]"
Python requirement: >=3.10.11,<4.0
Documentation
🌐 Live docs site: https://mgtx-data-science.github.io/xlwings_package/ · source: docs/index.md · also mirrored on the GitHub Wiki.
Every guide is full-lifecycle — initialise → paste data in → read it back out → update → format → save — with inline Excel-grid diagrams showing exactly what to highlight and what each step does to the sheet.
Scenario guides
- Normal named-range tables — build a table by hand in Excel and drive it from Python (no Benchling).
- One Benchling table — pull a single result schema onto a sheet and write results back.
- Many Benchling tables (multi-sheet) — lay out several schemas across multiple sheets from a dict of ids.
- Plates — 6 / 12 / 24 / 48 / 96 / 384 / 1536-well and custom layouts with named-range round-trips.
Understand the engine
- Stacked tables & Benchling reinitialise — how managed tables stack (disjoint rows, danger zone, auto-heal), and how reinitialising with more columns auto-widens a table while protecting the neighbour below.
Reference & operational
- Full tools reference — every public function + exception, with verbatim signatures and examples.
- Credentials
— constructing the Benchling
ctx. - Common patterns — config cells, dropdowns, sheet management, plotting, file IO.
Quickstart
import xlwings as xw
from xlwings_package import initialize_workbook, initialise_table_benchling
wb = xw.Book.caller()
initialize_workbook(wb)
# Pull a Benchling schema and lay it out on a sheet.
results = initialise_table_benchling(
wb,
"Assay Results",
["assaysch_abc123"],
ctx=my_benchling_context, # see the Credentials guide
)
See the single-Benchling guide for the full seven-step pattern (init → headers → read → transform → write → colour → save).
Testing
# Unit tests (no Excel required) — pure-Python fake workbook harness.
pytest tests/unit/ -q
# Integration tests (require a live Excel installation on Windows).
pytest tests/integration/ -q
Integration tests write inspectable artifacts to
tests/integration/excel_table_tests/ — open any .xlsx to see what each
test produced.
Debugging
Best-effort operations (cell merges, sheet moves, bookmark auto-heal) swallow Excel COM errors so they don't interrupt your workflow. To surface those errors during debugging:
import logging
logging.basicConfig(level=logging.DEBUG)
Production code paths that detect data-corruption risks (occupancy conflicts, column overflow, missing schema metadata) always raise — debug logs are only relevant for cosmetic / non-load-bearing failures.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mgtx_xlwings_utils-0.1.2.tar.gz.
File metadata
- Download URL: mgtx_xlwings_utils-0.1.2.tar.gz
- Upload date:
- Size: 72.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53933e6d8869212427ac6832dcce3bdac93dbd681936ecd554c19598a55657f1
|
|
| MD5 |
2e61e723027ccd7b21daab1190e2b340
|
|
| BLAKE2b-256 |
5dfa9378e4cd52196c2afd0d3e8dd14bcd34c496881c9aaceaeea7236225f4a0
|
Provenance
The following attestation bundles were made for mgtx_xlwings_utils-0.1.2.tar.gz:
Publisher:
ci.yml on MGTX-Data-Science/xlwings_package
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mgtx_xlwings_utils-0.1.2.tar.gz -
Subject digest:
53933e6d8869212427ac6832dcce3bdac93dbd681936ecd554c19598a55657f1 - Sigstore transparency entry: 1717973314
- Sigstore integration time:
-
Permalink:
MGTX-Data-Science/xlwings_package@3aa8232aa696501413d2190bd6aecfde500b7afa -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/MGTX-Data-Science
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@3aa8232aa696501413d2190bd6aecfde500b7afa -
Trigger Event:
push
-
Statement type:
File details
Details for the file mgtx_xlwings_utils-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mgtx_xlwings_utils-0.1.2-py3-none-any.whl
- Upload date:
- Size: 77.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f9ba872832386d31b40e1372a2479bbd546b54bd2c302beced5af863b3b70b1
|
|
| MD5 |
46fa3fb69af03da4f2e4a40dd54d7f47
|
|
| BLAKE2b-256 |
b56983114b297dafd0db9afa937551a56ade2f984aa382ea997e5be0d5dbc6b0
|
Provenance
The following attestation bundles were made for mgtx_xlwings_utils-0.1.2-py3-none-any.whl:
Publisher:
ci.yml on MGTX-Data-Science/xlwings_package
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mgtx_xlwings_utils-0.1.2-py3-none-any.whl -
Subject digest:
1f9ba872832386d31b40e1372a2479bbd546b54bd2c302beced5af863b3b70b1 - Sigstore transparency entry: 1717973431
- Sigstore integration time:
-
Permalink:
MGTX-Data-Science/xlwings_package@3aa8232aa696501413d2190bd6aecfde500b7afa -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/MGTX-Data-Science
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@3aa8232aa696501413d2190bd6aecfde500b7afa -
Trigger Event:
push
-
Statement type: