Skip to main content

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.


What's new

0.1.35 — Autopaste (initialise_table_benchling(mode="autopaste")) now leaves table_gap blank rows below a manually built table or notes, not just below other managed tables. Previously a Benchling table placed under a hand-made table had no separation and its title row stuck to the content above. Pass table_gap=0 to restore the old flush placement.

Full history: CHANGELOG.md.


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

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

mgtx_xlwings_utils-0.2.0.tar.gz (91.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mgtx_xlwings_utils-0.2.0-py3-none-any.whl (96.9 kB view details)

Uploaded Python 3

File details

Details for the file mgtx_xlwings_utils-0.2.0.tar.gz.

File metadata

  • Download URL: mgtx_xlwings_utils-0.2.0.tar.gz
  • Upload date:
  • Size: 91.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mgtx_xlwings_utils-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5dc878a09fbac4c274d10c060f7bb360ae874b448c2f1d56cf4e32b0f3d438b5
MD5 bf1c0cfe82634d9188d3929b9a690815
BLAKE2b-256 4dc6fe04b930c13fa68be06d5c8ccbe5a6c7d7bf88ef0a832b51bd566fcdd2e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for mgtx_xlwings_utils-0.2.0.tar.gz:

Publisher: ci.yml on MGTX-Data-Science/xlwings_package

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mgtx_xlwings_utils-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mgtx_xlwings_utils-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c8ba81d5695c1000a50a7006c7c98e3e2b53195093315220b2b3f112b3fa739
MD5 66c19cc81d830653cc78ad4f46f8e1e1
BLAKE2b-256 19aaa10b0e22843ce36a20aba00a5cb6c5243b5713fee3c0aac835183907efe3

See more details on using hashes here.

Provenance

The following attestation bundles were made for mgtx_xlwings_utils-0.2.0-py3-none-any.whl:

Publisher: ci.yml on MGTX-Data-Science/xlwings_package

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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