How to convert XML to CSV

XML and CSV formats are both widely used for storing and exchanging data, but have very different structures. XML is markup text structured in the form of a tree and CSV is escaped text structured as a table. However you can easily convert XML to CSV format with Easy Data Transform:

XML to CSV

convert XML to CSV

XML to CSV converter

Example XML input:

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <record>
    <CategoryID>1</CategoryID>
    <CategoryName>Beverages</CategoryName>
    <In_stock>true</In_stock>
  </record>
  <record>
    <CategoryID>2</CategoryID>
    <CategoryName>Condiments</CategoryName>
    <In_stock>false</In_stock>
  </record>
  <record>
    <CategoryID>3</CategoryID>
    <CategoryName>Confections</CategoryName>
    <In_stock>true</In_stock>
  </record>
</root>


Example CSV output:

CategoryID,CategoryName,In_stock
1,Beverages,true
2,Condiments,false
3,Confections,true


The dot (‘.’) character is used to show nesting of XML values and XML attribute values start with an underscore (‘_’). For example:

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <record carb="2" cholesterol="5" fiber="0" name="Avocado Dip" protein="1" sodium="210">
    <minerals>
      <ca>0</ca>
      <fe>0</fe>
    </minerals>
    <vitamins>
      <a>0</a>
      <c>0</c>
    </vitamins>
  </record>
</root>


Will be ‘flattened’ into CSV as:

_carb,_cholesterol,_fiber,_name,_protein,_sodium,minerals.ca,minerals.fe,vitamins.a,vitamins.c
2,5,0,Avocado Dip,1,210,0,0,0,0


You can use a Rename Cols transform if you want to rename any of the columns before output.

If you have large number of files to convert you can do it using batch processing.

As well as changing file format, Easy Data Transform also allows you to combine 42 transforms (such as merge, dedupe and filter) to quickly and easily create simple or complex data transformations. See our quick start guide for more details.

XML to CSV

Try it free now!

Windows Logo Windows Download

v1.6.2 for Windows 10 / 8 / 7 (48 MB)

Apple Logo Mac Download

v1.6.2 for Mac 10.15 to 10.12 (22 MB)


Questions or problems?

Email support@easydatatransform.com


Do you have a question?
We would love to help.

This pop-up will not be shown again