Convert CSV to XML

Turn CSV files into XML. Objects become elements inside one root element and every value becomes text, with characters a tag name cannot hold turned into underscores.

Converted in an isolated sandbox on our serversDeleted after 24 hours

Drop CSV files on the dialor turn it to pick what to do

Your table as one XML file.Each row becomes an element inside a single root element. Every value is written as text.

  1. What you get

    One XML file. The rows of your CSV sit inside one root element, and each value becomes an element holding text. XML has no separate number or date types here, so every value is text.

    Characters that a tag name cannot hold are turned into underscores. This matters when a column heading has spaces or other odd characters, because the heading becomes the element name.

  2. How special keys are handled

    A key that starts with @ becomes an attribute instead of an element. A key named #text becomes the element's own text. Where an attribute would hold a list or an object, it is written as JSON text.

    A list repeats its element, once for each item. An empty list therefore disappears from the output, and a list of lists is flattened into one run of repeated elements.

  3. Choosing the delimiter

    The delimiter is the character between fields. When you leave it out, it is guessed from the rows. Set Delimiter to comma, semicolon, tab or pipe if the guess is wrong.

    Spreadsheets in many European locales use semicolons, so a file exported from one of them is a case where you may want to set it yourself.

    To go the other way, use XML to CSV.

CSV and XML.What each format is, and the options this conversion takes.

  1. 01 · delimiter

    Delimiter

    The character between fields. It is guessed from the rows when left out. Spreadsheets in many European locales use semicolons.

    • comma A comma.
    • semicolon A semicolon.
    • tab A tab.
    • pipe A vertical bar.
    comma · semicolon · tab · pipe

The formats

From · CSV

CSV

Rows of comma-separated values. The plainest way to move a table between programs.

Extensions
.csv
MIME type
text/csv
Kind
Text and data
To · XML

XML

XML documents and data.

Extensions
.xml
MIME type
application/xml
Kind
Text and data

In your code.The same CSV to XML conversion through the API, for your app or your agent.

terminal
$ cv convert sheet.csv sheet.xml
$ cv convert sheet.csv sheet.xml

Questions.What people ask about CSV to XML.

01OF 04

No. Every value becomes text, so numbers and dates are written as text inside their elements.

No. It is guessed from the rows when you leave Delimiter out. Set it to comma, semicolon, tab or pipe if you want to choose.

Characters a tag name cannot hold are turned into underscores. A heading with a space gets an underscore in its place in the element name.

No. A list repeats its element once per item, so an empty list disappears from the output.

More conversions.Other ways in and out of CSV and XML.