CSV to XML Converter

Wraps CSV rows as XML elements on this page.

Use this tool

Input CSV format

Parsed table

Result

The result appears in this panel after you run the tool.

About this tool

Each data row becomes a row element. With Header row on, the child elements use the header cells as names. With it off, the children are named c1, c2, and so on. This is a flat table conversion.

How to use it

  1. Paste a table or open a file.
  2. Leave Header row on to use the first row as element names. Turn it off to use c1, c2, and so on.
  3. Use Convert.

Limitations

Flat cells under repeated row tags

Headers become child names, or c1, c2 when there is no header

The input dialect splits the file. When the header control is on, each later row becomes an object whose keys are the header cells and whose values are strings. A repeated header name keeps the last column only. Earlier cells under the duplicate name are dropped before XML is built. When the header control is off, columns are named c1, c2, and so on, in order, and every row including the first becomes an object of those names. The builder then writes a row element for each object, with formatting on.

There is no nesting to preserve, because a cell is one string. A dotted header remains a single tag name that contains a dot, if the builder accepts it, rather than a nested element. A header that starts with @_ is dangerous: the builder treats that prefix as an attribute name. A column titled that way can become an attribute of row instead of a child element. Ordinary headers become child elements. Indentation in the XML is the builder’s. The CSV separator is gone.

Types and nulls

Every value is text. A cell that looks like a number is still text in the object, so a leading zero survives into the tag’s text. An empty cell is an empty string, which is not a JSON null and does not become the word null. It may show up as an empty child. You cannot recover a distinction the CSV never stored. Quotes and escapes mattered only while splitting. They are not XML attributes unless the header spelling triggers the attribute prefix.

Extra cells and short rows

With a header, cells past the header width are ignored, the same way the JSON conversion ignores them. Short rows omit keys or leave them empty depending on the split, and the XML simply lacks a child or has an empty one. The document is a sequence of row elements, not one table element with a schema. Use it when a flat file should become repetitive XML. Use JSON-to-XML when you already have nested objects and attribute prefixes you chose on purpose.

Privacy

Your input is processed in your browser and is not uploaded to UtilChain. File names, text, and results are not sent to analytics.