How to convert XML to CSV or TSV
- Paste your XML document into Input (XML), open an
.xmlfile, or click Sample. - Select a Delimiter (comma, semicolon, tab, or pipe), and toggle Header row, Flatten nested elements, or Include attributes.
- Click Convert to CSV, then copy the table or download a
.csvfile for Microsoft Excel, Google Sheets, or database import.
How repeating XML elements become spreadsheet rows
Repeating child elements of the root element (such as <book> inside <catalog>, or <item> inside an RSS feed) become rows, and every child element or attribute found across all records becomes a column in first-seen order.
- Nested elements: with Flatten nested elements checked, nested tags are joined with dots (for example
author.name). Uncheck it to keep nested structures as compact JSON in the cell. - Attributes: with Include attributes checked, XML attributes are exported as
@attrcolumns (for example@idorprice.@currency). - Repeated tags inside a row: multiple leaf tags with the same name inside a single record are joined with commas inside a quoted CSV cell so columns remain aligned.
Example: XML catalog to CSV
Input XML:
<catalog>
<book id="b1">
<title>The Pragmatic Programmer</title>
<price currency="USD">42.5</price>
</book>
<book id="b2">
<title>Clean Code & Design</title>
<price currency="USD">38</price>
</book>
</catalog>Converted CSV output:
@id,title,price.@currency,price
b1,The Pragmatic Programmer,USD,42.5
b2,Clean Code & Design,USD,38Frequently asked questions
- How does the XML to CSV converter detect rows and columns?
- The converter inspects the root element and treats its repeating child elements (for example
<book>,<item>, or<record>) as table rows. It then collects every nested tag and attribute across all records in first-seen order to build the column headers. - How are XML attributes exported in the CSV file?
- When Include attributes is checked, attributes on each record or nested element are exported as columns prefixed with
@(such as@idorprice.@currency). Uncheck it if you only want element text values. - Which delimiter should I choose for Microsoft Excel?
- Use Comma (,) for Google Sheets and English versions of Excel, Semicolon (;) for European locales where comma is the decimal separator, or Tab to paste directly into an open spreadsheet.