
Converting XML to Excel With Python and Typed Cells
Write an XML file into an xlsx workbook with openpyxl so numbers are numbers, booleans are booleans and identifiers stay text, and read it back to check.
Everything you need to level up your coding skills.

Write an XML file into an xlsx workbook with openpyxl so numbers are numbers, booleans are booleans and identifiers stay text, and read it back to check.

Turn a nested XML file into a flat CSV with Python, joining repeated authors into one cell with correct quoting, and see why pandas read_xml dropped one.

One XML file converted to JSON, CSV, YAML and Excel with one parse and four writers, what each target loses, and how to prove nothing went missing.

Load a Google Merchant style product feed into PostgreSQL with xmltable and a namespace, split price from currency, and handle missing GTINs and empty prices.

Store XML whole, shred it into tables, or both? What each engine keeps and loses, what validation you get, and what it costs on 200,000 documents.

A tested guide to XML in Python: ElementTree versus lxml, reading, streaming, writing, namespaces, validation, XSLT, tables, safety and an end-to-end script.

XPath basics on a small library document: absolute and relative paths, //, *, @ attributes, text(), the parent step and the node-set versus value results.

A tested XPath guide: the twenty expressions that cover most needs, the traps (namespaces, positions, units, injection), tools, timings on 200,000 records.

When a minified XML file will not parse, xmllint --format and lxml refuse to indent it. A 30-line tokenizer indents what it can and flags the first mismatch.

When an XML feed mixes encodings or was encoded twice: why detectors guess wrong on short text, the UTF-8 first rule and per-line fallback.

Repair a 29 MB XML export with 215,385 raw ampersands using a lookahead regex that leaves existing entities alone, with the cases that need judgment.

Fix ElementTree ParseError unbound prefix and lxml Namespace prefix is not defined: fragments cut from a document, auto-declared prefixes, recover.
We send one email when a new article is published. No spam.