Convert XML to CSV
This tool converts an XML document to CSV in your browser, so that an export, a feed or an API response becomes something a spreadsheet can open directly. The shallowest element that repeats becomes the rows, and everything outside it is left out of the table; without a repeated element, the document gives one row below its wrappers. A nested element becomes a column named by its path joined with /, an attribute keeps its @, and a name that repeats inside a row becomes numbered columns such as tag[1] and tag[2] in every row. Every value stays exactly the string the document holds, and the delimiter is a setting. Your file is never uploaded.
Runs in your browser
Drop a file here
XML, up to 50 MB
How it works
- 1 Choose an XML file.
- 2 Set the delimiter if the result should not use a comma.
- 3 GRID16 finds the rows and columns and writes the table in your browser.
- 4 Download the CSV.
Questions
- Which element becomes a row?
- The shallowest element that repeats among its siblings. When two names repeat at the same depth, the one that occurs more often wins, and a tie goes to the name that appears first. A repeated element nested inside a row, such as an order's items, stays inside the row because the row element is found first.
- What happens without a repeated element?
- The document gives one row. The walk descends through wrapper elements that add no field of their own, so an export with one record gives the same columns as one with several.
- How does a nested element become a column?
- Its path from the row element, joined with /: customer/name for a name nested in customer. An attribute keeps its @, so price and price/@currency are two different columns.
- What happens when a name repeats inside a row?
- It becomes numbered columns, tag[1] and tag[2] for example, counted from 1 and kept in every row up to the largest count seen; a row with fewer gets empty cells for the columns it lacks.
- Are values changed?
- No. Every value stays exactly the string the document holds; nothing is trimmed or converted to a number. An empty element gives its column with an empty cell.
- What happens with invalid XML, a DOCTYPE, or a document without values?
- The job stops and says why. A document with a DOCTYPE or an ENTITY declaration is refused before parsing, XML that does not parse is reported with the parser's own message, and a document with no value to put in a table, such as an empty root element, is refused too.
- Is my file uploaded to a server?
- No. The conversion happens in your browser; the file never leaves your device.