A surgical XML injector for .xlsx files. Reads and writes specific cell values directly into the archive without altering formatting, metadata, or breaking modern dynamic array formulas.
Project description
xlinject
A surgical XML injector for .xlsx files.
xlinject is designed to read and write specific cell values directly inside the XLSX archive while preserving formatting, metadata, and modern Excel dynamic array semantics.
Status: Alpha testing/release - API-first
Who this is for
xlinject is useful when you have Excel templates with modern formulas (LET, FILTER, dynamic arrays, custom metadata)
and need to inject measured values without changing workbook structure or formatting.
Typical workflow:
- Fetch data from an external API.
- Build a mapping from
A1cell references to numeric values. - Inject values with
xlinject. - Open workbook in Excel with formulas and layout preserved.
Why this project exists
Object-model-based libraries often deserialize and reserialize full workbook structures. During that process, unsupported XML tags/attributes can be dropped. xlinject will instead target specific XML nodes in-place to minimize collateral changes.
Scope
- API-first injection via
{A1: value}mappings - Guarded formula-safe writes
- Workbook recalc policy on write (
calcPrflags + calc chain handling) - Optional single generic CLI command for manual use
See docs/ROADMAP.md for phased details.
Documentation
See:
Development setup (uv)
Prerequisites
- Python 3.11+
- uv
Quick start
uv sync --dev
uv run pre-commit install
Quality checks
uv run pre-commit run --all-files
uv run ruff check .
uv run mypy .
uv run pytest
Style policy
- Avoid em dashes (
--) in repository text. - Avoid emojis in repository text.
These checks run via pre-commit locally and in CI.
Direct write API
from pathlib import Path
from xlinject import inject_cells
report = inject_cells(
"source.xlsx",
"output.xlsx",
sheet_name="Eingabemaske",
cell_values={
"B45": 45717.25,
"C45": "12,34",
"D45": 15.67,
},
guard_cells=["H2"],
)
print(report)
This writes only the listed cells and keeps formula XML intact unless allow_formula_overwrite=True is explicitly set.
Detailed API options, recalc policy behavior, helper patterns, and CLI usage:
Data safety and sharing
- Do not commit customer workbooks, meter IDs, or API tokens into this repository.
- Use synthetic fixtures in tests and docs.
- Keep integration examples anonymized (for example
SITE_A,SITE_B,X1234). - If you publish logs, redact workbook paths and business identifiers.
License
xlinject is open source under the GNU General Public License v3.0 or later (GPL-3.0-or-later).
See LICENSE for the full license text.
Project details
Release history Release notifications | RSS feed
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 xlinject-0.2.0a1.tar.gz.
File metadata
- Download URL: xlinject-0.2.0a1.tar.gz
- Upload date:
- Size: 91.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9bce3fbf9cd8c785918eb45a8bce74c63da1334e92cda35f8aeb208ba04c4f8
|
|
| MD5 |
d56a0b8622c9dc4028ea0aefa5bf00ad
|
|
| BLAKE2b-256 |
a3efa6aade8801f11d14455f9f044d7246ee8809f6152a15824b6ea645d4336a
|
Provenance
The following attestation bundles were made for xlinject-0.2.0a1.tar.gz:
Publisher:
publish-pypi.yml on KyleDerZweite/xlinject
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xlinject-0.2.0a1.tar.gz -
Subject digest:
c9bce3fbf9cd8c785918eb45a8bce74c63da1334e92cda35f8aeb208ba04c4f8 - Sigstore transparency entry: 1030908051
- Sigstore integration time:
-
Permalink:
KyleDerZweite/xlinject@6aee55393923f2ea1b0c8c5827d1cc72f0d22518 -
Branch / Tag:
refs/tags/v0.2.0a1 - Owner: https://github.com/KyleDerZweite
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@6aee55393923f2ea1b0c8c5827d1cc72f0d22518 -
Trigger Event:
release
-
Statement type:
File details
Details for the file xlinject-0.2.0a1-py3-none-any.whl.
File metadata
- Download URL: xlinject-0.2.0a1-py3-none-any.whl
- Upload date:
- Size: 39.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18e5d707249aa290027941dc9d44a4691107330327f294c2fce116097dbaeeca
|
|
| MD5 |
98d4ba46716fd92688d7b0bd54b6400f
|
|
| BLAKE2b-256 |
dfa7e40049fa6a78caf892e599a066e628c9493189cf2eeb89769c8b33cc8d51
|
Provenance
The following attestation bundles were made for xlinject-0.2.0a1-py3-none-any.whl:
Publisher:
publish-pypi.yml on KyleDerZweite/xlinject
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xlinject-0.2.0a1-py3-none-any.whl -
Subject digest:
18e5d707249aa290027941dc9d44a4691107330327f294c2fce116097dbaeeca - Sigstore transparency entry: 1030908089
- Sigstore integration time:
-
Permalink:
KyleDerZweite/xlinject@6aee55393923f2ea1b0c8c5827d1cc72f0d22518 -
Branch / Tag:
refs/tags/v0.2.0a1 - Owner: https://github.com/KyleDerZweite
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@6aee55393923f2ea1b0c8c5827d1cc72f0d22518 -
Trigger Event:
release
-
Statement type: