Dump Excel (.xlsx) physical structure to JSON
Project description
xldump
A Python library and CLI tool that dumps the physical structure of Excel (.xlsx) files to JSON.
The core value is a wrapper that converts openpyxl Cell objects into structured dict/JSON.
Features
- Deterministic & Reproducible: Extracts only physical structure without using LLM
- openpyxl Compatible: Field names aligned with openpyxl attribute names
- Flexible Output Options: Individual control for styles, values, merges, borders, validations, and images
- NDA-Safe Mode: Use
--no-valuesto exclude cell values and safely extract only style structure
Installation
pip install xldump
Or using uv:
uv add xldump
CLI Usage
# List sheets
xldump scan design_doc.xlsx
# Dump all sheets
xldump dump design_doc.xlsx
# Specific sheets only
xldump dump design_doc.xlsx -s "Sheet1" "Sheet2"
# Style-only mode (no values = NDA-safe)
xldump dump design_doc.xlsx --no-values
# Output to file
xldump dump design_doc.xlsx -o output.json
# Compact output
xldump dump design_doc.xlsx --compact
Library Usage
import xldump
# Get sheet list (lightweight & fast)
sheets = xldump.scan("design_doc.xlsx")
for sheet in sheets:
print(f"{sheet.name}: {sheet.max_row} rows x {sheet.max_column} cols")
# Dump entire workbook
workbook = xldump.dump("design_doc.xlsx")
print(workbook.to_dict())
# Dump single sheet
sheet = xldump.dump_sheet("design_doc.xlsx", "Sheet1")
print(sheet.to_dict())
# With options
workbook = xldump.dump(
"design_doc.xlsx",
sheets=["Sheet1", "Sheet2"], # Target sheets
include_styles=True, # Style information
include_values=True, # Cell values
include_merges=True, # Merged cell information
include_borders=True, # Border information
include_validations=True, # Data validations
include_images=True, # Image position information
data_only=False, # Get calculated results instead of formulas
)
Output Examples
scan output
{
"file": "design_doc.xlsx",
"sheet_count": 3,
"sheets": [
{
"name": "Design",
"index": 0,
"dimensions": "A1:F30",
"max_row": 30,
"max_column": 6,
"merged_cell_count": 12,
"has_images": true,
"has_data_validations": true
}
]
}
dump output
{
"file": "design_doc.xlsx",
"sheets": [
{
"name": "Design",
"index": 0,
"dimensions": "A1:F30",
"merged_cells": [
{
"range": "A1:D1",
"min_row": 1, "max_row": 1,
"min_col": 1, "max_col": 4
}
],
"rows": {
"1": {
"A": {
"coordinate": "A1",
"value": "1. System Overview",
"data_type": "s",
"style": {
"font": {
"name": "Arial",
"size": 14.0,
"bold": true
},
"fill": {
"type": "solid",
"fg_color": "FF4472C4"
}
}
}
}
}
}
]
}
Development
# Clone repository
git clone https://github.com/xlbone/xldump.git
cd xldump
# Install dependencies
uv sync --all-groups
# Run tests
poe test
# Run all checks
poe check
Notes
- Only
.xlsxformat is supported (legacy.xlsformat is not supported) data_only=Truereturns cached values from when the file was last opened in Excel. ReturnsNoneif not calculated
License
MIT License
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 xldump-0.4.0.tar.gz.
File metadata
- Download URL: xldump-0.4.0.tar.gz
- Upload date:
- Size: 92.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e081d844ec96ad840fadaef207990ba7d5703121041cbe54e7deb66819961a02
|
|
| MD5 |
9a906633eeba43daaeebea18cbad2e96
|
|
| BLAKE2b-256 |
ebc8eaffb922b03b8a91f4664fd6a45367d93fdaeba5dca23022686a284c2315
|
Provenance
The following attestation bundles were made for xldump-0.4.0.tar.gz:
Publisher:
release.yml on xlbone/xldump
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xldump-0.4.0.tar.gz -
Subject digest:
e081d844ec96ad840fadaef207990ba7d5703121041cbe54e7deb66819961a02 - Sigstore transparency entry: 1006369527
- Sigstore integration time:
-
Permalink:
xlbone/xldump@1ccbbb6394b1445623acbc33ff650c08ec7a369b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/xlbone
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1ccbbb6394b1445623acbc33ff650c08ec7a369b -
Trigger Event:
push
-
Statement type:
File details
Details for the file xldump-0.4.0-py3-none-any.whl.
File metadata
- Download URL: xldump-0.4.0-py3-none-any.whl
- Upload date:
- Size: 19.6 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 |
58d63ccf1742c35f8fe09972052c29254cbc475711860e9ecc80905748eedb04
|
|
| MD5 |
081050abba7aa692a5a438853961ebc9
|
|
| BLAKE2b-256 |
51b4fba1fa2e440ef2412d88f4014c45996a5712aabeb2f7eafdcda9a85e1550
|
Provenance
The following attestation bundles were made for xldump-0.4.0-py3-none-any.whl:
Publisher:
release.yml on xlbone/xldump
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xldump-0.4.0-py3-none-any.whl -
Subject digest:
58d63ccf1742c35f8fe09972052c29254cbc475711860e9ecc80905748eedb04 - Sigstore transparency entry: 1006369529
- Sigstore integration time:
-
Permalink:
xlbone/xldump@1ccbbb6394b1445623acbc33ff650c08ec7a369b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/xlbone
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1ccbbb6394b1445623acbc33ff650c08ec7a369b -
Trigger Event:
push
-
Statement type: