If you've ever needed to share structured Python data (like nested dicts or lists) with non-developers, chances are you've hit this classic wall:
Can you export that to Excel?
And suddenly, you're fighting two worlds that just weren't made for each other.
Most tools expect flat tabular data. Your data isn't flat. So you end up writing brittle custom converters, or flattening everything and losing structure. And don't even get me started on round-tripping that back into Python…
I got tired of it. So I built excel-serializer: a Python library that lets you treat Excel like JSON — you can dump()
and load()
complex, nested structures without losing anything.
What it does
- Serialize any Python data structure (dicts, lists, nested combos) to .xlsx
- Read it back with full fidelity — like json.load()
- Structure is preserved across sheets, and stays human-readable/editable
- Bonus: it also comes with a CLI for easy use in scripts or from the terminal
Install it
pip install excel-serializer
Basic usage (Python)
import excel_serializer as es
data = {
"users": [
{"name": "Alice", "scores": [1, 2, 3]},
{"name": "Bob", "scores": [4, 5, 6]},
],
"meta": {"source": "generated", "count": 2},
}
# Write to Excel
es.dump(data, "data.xlsx")
# Read it back
loaded = es.load("data.xlsx")
CLI usage
Let’s say you have a JSON file like this:
{
"people": [
{"name": "Alice", "age": 30},
{"name": "Bob", "age": 25}
],
"meta": {"created": "2025-03-26"}
}
You can convert it to Excel with:
cat people.json | json2xlsx -o people.xlsx
And convert it back:
xlsx2json -i people.xlsx > output.json
That’s it — no flattening, no config, no lost nesting.
Why not use pandas / openpyxl / whatever?
Because most of those tools:
- Expect tabular data (not trees of dicts and lists)
- Flatten nested structures or choke on them
- Don’t offer a load()/dump() API with guaranteed round-tripping
- Require too much boilerplate for simple tasks
excel-serializer
is opinionated but practical: it chooses a clear way to represent nested data across sheets and makes it dead simple to work with.
Try it out
📦 PyPI
💻 GitHub Repo
Whether you’re building internal tools, working with analysts, or just want a better way to share structured data, give it a shot — and let me know what breaks 😄
Top comments (0)