xlsxflat
For the person who keeps writing a throwaway script to turn a year and month tree of spreadsheet "reports" back into a table. It reads the tree, writes one flat CSV, and writes a report of every change it made. When a sheet can be read in more than one defensible way, it skips that sheet and says why, instead of guessing.
pip install xlsxflat==0.1.0
xlsxflat ./reports -o table.csv --report changes.md
xlsxflat: 4 rows to table.csv, 2 sheet(s) skipped
skipped 2026/02/sites.xlsx/Summary: row 1 is written across several columns by a merged range, so it may be the upper half of a two level header; pass --header-row to say which row names the columns
skipped 2026/03/sites.xlsx/Sheet2: header row 1 names the same column twice: ['site']
That block is the real output of a run, produced by a test so that it cannot drift from the code.
What it does to a sheet
- the header is the first row whose filled cells are all text and that fills at least two columns, or the only column when the sheet has one
- repeats the value of a merged range over the whole range, so a label that covered six rows is on all six
- drops rows and columns that hold nothing at all
- keeps the original place of every value: each written row carries
source_file,source_sheet,source_rowandperiod - reads a period out of the path below the folder you walked, when it is there:
2026/03/,2025_11 archive,2024 - unions columns across files instead of dropping the odd one out
What it refuses to do
It never guesses a shape. A sheet is skipped, with the reason written in the report, when:
- a row that looks like the header is written across several columns by a merged range, so it may be the upper half of a two level header
- the header names the same column twice
- the header leaves a column without a text name, while that column holds values
- the header uses one of
source_file,source_sheet,source_row,period, which would be overwritten - no row reads as a header at all
- the sheet holds no value at all, which is what an untouched default sheet looks like
--header-row Nwas given and that row is empty in this sheet- the file could not be opened at all
--header-row N answers the first case and the sheet goes through.
Exit codes
| code | meaning |
|---|---|
| 0 | finished; read the report for skipped sheets |
| 2 | the target does not exist |
| 3 | --strict, and a sheet was skipped |
| 4 | the target is not an .xlsx and holds none |
--strict is for a pipeline that must stop on a skipped sheet. Note that an empty default sheet counts as skipped, so a tree full of workbooks with a leftover Sheet1 will trip it.
Limits worth knowing before you install
- column names are matched exactly, so
Siteandsitecome out as two columns - it reads
.xlsxonly: not.xls, not.csv, not Google Sheets - your workbooks are never written to: nothing is ever saved back, and a test compares the file bytes before and after
- it says nothing about whether your data is right; it says what the file held and what was done to it
openpyxlis the only dependency, and every date cell is written as ISO text
Price
The tool is free and MIT. There is nothing to buy today and no payment can be taken. If a supported build would be worth something to you, open an issue on the repository and it will be read.
Install from source
git clone https://github.com/Rezarys/xlsxflat
cd xlsxflat
pip install -e ".[dev]"
python -m pytest
Notes
Built with AI assistance, reviewed and tested by me. Bug reports are welcome, especially a sheet shape that should be read and is skipped, or the reverse.
MIT, Younes Z.
Metadata
Release files for xlsxflat 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xlsxflat-0.1.0.tar.gz | 14.1 kB | Without provenance | Details for xlsxflat-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xlsxflat-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for xlsxflat-0.1.0-py3-none-any.whl |
Total release size: 24.9 kB
Release files / xlsxflat-0.1.0.tar.gz
| Download URL | xlsxflat-0.1.0.tar.gz |
|---|---|
| Size | 14.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8498f8ca00935359dc958e627a8e82ab0d8f8b3f18b5ec9ac048505c8fd06c5e
|
|
BLAKE2b-256 checksum How to use checksums |
db17e1698e0ffdd3d9e0753d2afc58b5581a1380f97d36a3394854048c741d2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / xlsxflat-0.1.0-py3-none-any.whl
| Download URL | xlsxflat-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
36e88bf0c3bf0b6b8c3fa875cc677d1eb7de03568406c3c2bde1a89135667862
|
|
BLAKE2b-256 checksum How to use checksums |
b219cd23ea6d3962c66bf838f15fce5811d3c964b9ecd505419921fed9448f81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for xlsxflat 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.