DevSwitch.net
Back to Tools
⇄

TSV to XML Converter

Convert Tab-Separated Values (TSV) to XML format

File Converters

Tip: Paste your TSV data with tab-separated values. The first row will be used as XML element names.

Runs in your browser

Input TSV

Convert TSV to XML in your browser

Paste tab-separated text, open a .tsv file or drop it on the input window, and the XML appears as you type. Each line after the header becomes a <row> element inside one <root>, with a child element for every column. Copy the result or download it as an .xml file.

Rows copied from Excel or Google Sheets arrive as TSV, so a selected range with its header row can go straight into an XML feed or an import file.

TSV to XML example

Real output for a small product list. Every value is element text, written as it was in the TSV:

products.tsv
sku	product	qty	price
00412	Desk lamp, brass	2	39.9
00977	USB-C cable	10	4.50
products.xml
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <row>
    <sku>00412</sku>
    <product>Desk lamp, brass</product>
    <qty>2</qty>
    <price>39.9</price>
  </row>
  <row>
    <sku>00977</sku>
    <product>USB-C cable</product>
    <qty>10</qty>
    <price>4.50</price>
  </row>
</root>

From header cells to XML elements

The header line names the elements. A name XML would reject is fixed, not dropped:

Header cellIn the XMLWhy
sku <sku> A valid XML name is kept as it is.
unit price <unit_price> Spaces and characters other than letters, digits, _, - and . become underscores.
2025 <_2025> An element name cannot start with a digit, or with xml.
@sku <row sku="00412"> A name starting with @ becomes an attribute of the row.
(empty) <column_2> An empty name is numbered by its position; a repeated name gets its position added.

What goes inside each element

XML has no types, so a value is written as text exactly as it was in the TSV: 00412 keeps its zeros and 4.50 its last digit. The characters &, <, > and " are escaped, so a product called Nuts & bolts becomes Nuts &amp; bolts.

An empty cell becomes a self-closing tag such as <price/>, so every row has the same elements. The root and row names are fixed; rename them in the output if your import expects other names.

Need the TSV back?

The XML to TSV converter turns repeated elements back into tab-separated rows, with attributes as @name columns.

TSV to XML questions

Copy the cells in Excel or Google Sheets, header row included, and paste them into the input window. The clipboard holds TSV, so the XML appears straight away.

Yes. Click Open file and pick a .tsv, .tab or .txt file, or drop it on the input window; Download saves the XML as an .xml file.

The header held a space or a character XML does not allow in names, or the name started with a digit. Rename the column in the header line if you need a different element name.

No. In TSV only tabs separate columns, so Desk lamp, brass arrives in the XML as one value. Only a cell with a line break or a tab needs double quotes, and spreadsheets add them when you copy.

No. Converting runs in your browser, and an opened file is read there too.