XML to CSV Converter
Extract named flat XML records into CSV with exact leaf text and distinct columns
Convert a defined record mapping locally. Review the mapping rules below before using the output; this does not preserve every XML/JSON data model. Input stays in this page; drafts are not stored. Limits: 1 MiB input, 4 MiB output, 20,000 XML nodes including attributes, 64 element levels. Textareas normalize pasted line endings; upload UTF-8 to retain original CSV carriage returns.
The name selects the root itself or matching direct children; other root children are excluded. Record attributes become @name columns. Leaf text/CDATA values keep whitespace; record-level whitespace, comments and processing instructions have no CSV cells. Missing fields become empty text. Duplicate leaf names get distinct columns. No nested fields, child attributes or namespaces. Up to 5,000 rows × 100 columns.
About this tool
XML to CSV extracts a deliberate flat record subset. The exact row name selects the root itself or matching direct children; other root children are excluded, and a missing name never falls back to another record type. Record attributes become @name columns. Direct leaf elements become columns using their exact parsed text or CDATA value, including whitespace. Repeated leaf names receive globally distinct column names, and columns are the union across selected records. Missing fields become empty text. Record-level whitespace, comments and processing instructions have no CSV cells; CSV cannot preserve the distinction between missing and empty values. Namespaces, nested fields, child-field attributes and non-whitespace record-level mixed text are rejected. Up to 5,000 rows and 100 columns are allowed within the XML limits. CSV fields preserve text and are quoted as needed; how a spreadsheet interprets that text is controlled by the receiving software. Input is limited to 1 MiB, output to 4 MiB, XML to 20,000 nodes including attributes and 64 element levels. UTF-8 uploads use strict decoding; pasted text follows the browser textarea line-ending rules. Processing runs locally, and draft input is not saved.
Scenario Recipes
Extract a flat supplier record sample
Goal: Keep the selected record boundary and exact leaf values explicit.
- Identify the root or a repeated direct-child record name. Check that its fields are attribute-free leaves without namespaces.
- Convert and inspect @attribute columns, repeated-field mappings and empty cells. Leading zeros and text whitespace remain values.
- Download CSV and compare it with the recipient’s expected table. Use controlled text import if spreadsheet auto-detection would change values.
Result: A flat CSV extract with stated omissions and stable record selection.
Failure Clinic (Common Pitfalls)
A typo previously selected a different kind of record
Cause: Automatic fallback can silently turn a summary into a data row.
Fix: This tool now reports no selected records. Enter the intended exact root or direct-child name.
Nested XML cannot fit the flat table
Cause: Nested elements, child attributes and mixed text carry structure beyond a single leaf cell.
Fix: Transform that structure explicitly in a dedicated mapper; this tool rejects it rather than flattening it silently.
Production Snippets
Attributes and repeated children produce separate columns
xml
<records><record id="001"><tag>A</tag><tag>B</tag><tag_2>C</tag_2></record></records>
Columns: @id,tag,tag_2,tag_2_2
Values: 001,A,B,CFrequently Asked Questions
How do I select records?
Enter their exact name. It must match the root or its direct children. Other root children are excluded. Nested descendants are not added as extra records, and no auto-detection fallback occurs.
Are repeated fields or prototype-like names lost?
No. Repeated names get distinct columns with a displayed mapping. __proto__ and constructor are ordinary column names. Missing fields are empty strings.
What XML structures are rejected?
Records must have no namespaces, their child fields must be leaves without attributes, and record-level non-whitespace mixed text is rejected. Use a schema-aware transformation for deeper structures.
Can CSV recreate every original XML detail?
No. Empty and absent fields become empty cells; comments, processing instructions and record-layout whitespace have no cells. Names, values and record selection should be reviewed before import.
Keep browsing