TSV to XML Converter

Paste tab separated data and get well formed XML, with each row as an element and each column as a child tag or attribute.

TSV
XML
Runs locally in your browser

About the TSV to XML Converter

Spreadsheets and database exports hand you tab separated text, while the system on the other side wants XML. This converter bridges that gap without a script. The first row becomes the tag names, every following row becomes one record element, and the values are escaped so an ampersand in a company name or a less than sign in a measurement cannot break the document.

Column headings rarely make legal XML names, so they are cleaned before use: spaces and punctuation become underscores, and a heading that starts with a digit gains a leading underscore because XML names may not begin with one. A blank heading falls back to column3 and so on by position. If your file has no header row at all, untick the checkbox and every column is named by position instead.

The Values as switch decides the shape of the result. Child elements give the verbose form that most XML consumers expect, while attributes produce a compact one line record per row that is pleasant to read and much smaller on disk. Adding an index attribute numbers the rows from one, which is handy when the source order matters and the data has no key of its own. The delimiter menu also accepts comma, semicolon and pipe files, and quoted fields are unwrapped along the way. To go back the other way, use XML to TSV.

How to use

  1. Paste tab separated rows, or copy a block of cells straight out of a spreadsheet.
  2. Confirm whether the first row holds column names and set the checkbox to match.
  3. Type the Root tag and Row tag you want, for example stations and station.
  4. Choose child elements or attributes, then copy or download the XML.

Common questions

What happens to a heading like "daily entries"?
The space becomes an underscore, giving daily_entries, because XML element names cannot contain spaces.
Are values type converted?
No. Everything is written as text and escaped. XML has no native number type, so a schema decides how values are read later.
Can I use it for CSV as well?
Yes. Change the delimiter to comma, semicolon or pipe and the rest of the conversion works exactly the same.
What if a row has fewer cells than the header?
The missing columns are written as empty elements or empty attributes so every record keeps the same shape.