XML to TSV Converter
Convert XML data to TSV (Tab-Separated Values) format
Tip: XML should have repeating elements (like <row>) that will be converted to TSV rows.
Input XML
Convert XML to TSV in your browser
Paste XML, open an .xml file or drop it on the input window, and the tab-separated table appears as you type. Each repeated element is a line, and a tab separates its columns. Download saves a .tsv file.
Tabs are handy when the values contain commas, such as addresses or prices written as 12,50: they need no quotes. Click Copy and paste into the first cell of a sheet in Excel or Google Sheets, and the values land in separate columns.
XML to TSV example
Real output for a catalog of two books. The columns are separated by tabs, and the header comes from the attribute and child element names:
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<book id="bk101">
<title>Paper Tigers</title>
<author>Rina Okafor</author>
<price>12.50</price>
</book>
<book id="bk102">
<title>Salt Roads</title>
<author>Jonas Hale</author>
<price>9.99</price>
</book>
</catalog>
@id title author price
bk101 Paper Tigers Rina Okafor 12.50
bk102 Salt Roads Jonas Hale 9.99
How the XML tree becomes a table
-
Find the rows
The converter looks under the root for an element name that repeats, such as
<book>, and passes through wrappers that have a single child. Each copy is a row. If nothing repeats, the whole document is one row. -
Name the columns
Child elements give columns by name, attributes give
@columns like@id, and nested elements give dot paths likeaddress.city. A repeated child inside a row gives numbered columns:tag.0,tag.1. -
Fill the cells
Values are copied as text, exactly as written. A row without a value for some column gets an empty cell. A value with a tab, a double quote or a line break is put in double quotes, with inner quotes doubled.
Need XML from a TSV file?
The TSV to XML converter turns each line into a <row> element under <root>.
XML to TSV questions
Convert it here, click Copy and paste into cell A1 of an empty sheet; the tabs split the values into columns. To keep a file, click Download and open or import the .tsv in your spreadsheet.
It contains a tab, a double quote or a line break, which would otherwise break the table. Commas need no quotes in TSV, so Portland, OR stays as it is.
Those rows have no element or attribute for that column. The header holds every column found in any row, so a field that only some records carry leaves the others blank.
TSV is easier to paste and needs fewer quotes when values contain commas. Pick CSV when a program asks for it; the XML to CSV converter builds the same table with commas.
No. Converting runs in your browser, and an opened file is read there too.