Why convert XML to CSV?
XML is the standard export format for ERPs, CRMs, bank systems, and government portals, but its tag structure makes it awkward to analyse in a spreadsheet or load into a database. Converting to .CSV gives a flat, row-column layout that any tool can import without further transformation. The conversion works well as long as the XML has a regular, table-like structure.
How to convert XML to CSV
Microsoft Excel - Power Query BUILT-IN
Go to Data > Get Data > From File > From XML, pick the repeating element in Power Query, then File > Save As > CSV.
OpenOffice.org Calc FREE
Open the xml file in Calc, map elements to columns via the XML source panel, then export as Text CSV (.csv).
Command line - Python CLI
Write a short script using xml.etree.ElementTree and csv.writer, then run it as python convert.py input.xml output.csv.
Programs that convert XML
About these formats
An XML file is a plain-text document that stores structured data in nested, custom tags. Because it is just text, any text editor opens it - drag it into a browser tab for a quick,…
Open .XML details →A CSV file stores tabular data as plain text - one row per line, values separated by commas (or semicolons in European locales). Any spreadsheet opens it: Excel, Google Sheets, LibreOffice…
Open .CSV details →Quality & what to watch
- CSV is flat - nested XML elements and attributes are either dropped or collapsed into one text value; always inspect the output before relying on it.
- XML namespaces can produce messy column names like
{http://example.com/ns}fieldnamein the output; a preprocessing step that strips namespaces avoids this. - Ensure the tool writes UTF-8 if your
xmlcontains non-ASCII characters - Excel on Windows may default to the system code page and corrupt accented or non-Latin text.
Frequently asked questions
Does this work for any XML file?
xml does not convert to a useful flat csv automatically.What happens to nested elements?
xmltodict to flatten the structure before writing the csv.