XML to CSV
Flatten repeated XML elements into a CSV table: pick the row element path or let it auto-detect, choose column order, attribute prefix, delimiter and header, and keep nested children as JSON. Pure frontend with a self-written parser.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
What this tool does
- Flatten an XML list from an API (orders, products, users, logs) into CSV for Excel, Sheets or a database import.
- Export repeated elements in bulk: give the row element path and each record becomes one row, with child elements and attributes as columns.
- Line up fields by fixing the column order explicitly; missing fields are written as empty cells so the header matches an existing sheet.
Example
Input
<users> <user id="1"><name>Ada</name><age>36</age></user> <user id="2"><name>Bob</name><age>41</age></user> </users>
Output
name,age Ada,36 Bob,41
The row element path is auto-detected as users.user; enable "Export attributes as columns" and id shows up first as @id.
Frequently asked questions
Can I skip the row element path?
Yes. When it is empty the tool looks for repeated sibling elements (the user elements under users, for example). If nothing repeats, the root element is treated as a single row.
How do XML attributes get into the table?
Enable "Export attributes as columns" and attributes are written as @name columns in front of the child element columns; the prefix is configurable.
How are nested children represented?
Leaf nodes contribute their text. Elements with children are serialized to a JSON string by default, repeated siblings become a JSON array, and you can also keep the text only or leave the cell empty.
Is this using the browser XML parser?
No. It uses a small self-written parser instead of DOMParser, so results are identical in the browser and in Node, and errors such as mismatched tags or truncated input are reported reliably.
Keywords:xmlcsvxml to csvXML 转 CSV表格table属性attribute数据导出convert