TSV stands for tab-separated values, and the name says almost everything about the format. Open a .tsv file in Notepad or any text editor and you see the table itself: the column names on the first line, one record on each line below, and a tab character wherever one column ends and the next begins. Because it's only text, a spreadsheet, a database tool, a code editor or a script can all read it.
You'll meet TSV files as downloads from databases, analytics and SEO tools, and research data sets. Most of the time you only need to open one, check it and move the data somewhere else.
What a TSV file looks like
Here's a small keyword list saved as TSV. The gaps between the values are single tab characters, not spaces, which is why the columns don't line up neatly here; a spreadsheet lines them up:
keyword volume country
running shoes 74000 us
trail running shoes, women 5400 us
The first line holds the column names. Each line after it is one record with the same three values in the same order. Note the comma in the third line: in TSV it's just part of the text, with no quotes needed.
The rules of the format
TSV is registered with IANA as the media type text/tab-separated-values. The registration, from the University of Minnesota's Internet Gopher team, is short and sets only a few rules (IANA):
- Each record is one line.
- A tab separates the fields in a record.
- The first line contains the field names.
- Every record has the same number of fields.
- A field can't contain a tab.
Files usually end in .tsv, sometimes .tab. Excel saves tab-delimited files as .txt, so a .txt file can be TSV too.
TSV or CSV?
Both store one table as plain text. The difference is the separator, and that changes how each handles awkward values.
| You have | TSV | CSV |
|---|---|---|
| Values with commas (addresses, keyword phrases, prices like 1,200) | Fine as they are | The value must be wrapped in double quotes |
| Values with tabs | Not allowed; replace tabs before export | Fine |
| Values with line breaks | Not allowed by the basic rules | Allowed inside quotes |
CSV gets around commas by quoting values, which its common specification, RFC 4180, allows. TSV avoids the question: tabs rarely appear in normal text, so values usually need no quoting at all. That makes TSV easier to read by eye and easier to split with simple scripts.
How to open a TSV file
In Google Sheets: open a spreadsheet, click File > Import and upload the file. Sheets accepts .tsv and .tab files. If the columns don't split, choose Tab under "Separator character."
In Excel: on the Data tab, click From Text/CSV, pick the file and click Import. In the preview, choose Tab under Delimiter if Excel didn't detect it. Opening a .txt file directly starts the Text Import Wizard, which asks for the delimiter in step 2.
To save a sheet as TSV in Excel, use File > Save As and choose Text (Tab delimited). Like any text format, it keeps only the values of one sheet: no formulas, formatting or charts.
Common problems and fixes
- Everything lands in one column. The program used the wrong separator. Re-import and choose Tab.
- Leading zeros disappear (ZIP codes, product IDs). Excel guessed the column was a number. Import through From Text/CSV or the wizard and set that column to Text.
- Columns shift in some rows. A value contained a tab or a line break. Clean those characters in the source before exporting.
- Strange characters in names or non-English keywords. The file and the program disagree about the character encoding. Save or export as UTF-8 and import it as UTF-8.
- The file is too big for a spreadsheet. Excel stops at 1,048,576 rows. Larger files need a database or a script.