Work with tab-delimited (tsv) format

Tab-delimited text, also known as tab-separated values (TSV), is a format that can be created or viewed by most spreadsheet programs and text editors. The TSV format follows these rules:
  • Each entry in the file takes up a single line.
  • The first line in the file is the header line, which labels each field.
  • A field contains data, such as a number or text.
  • Fields are separated by tabs.
  • Each line contains the same number of fields.
The following example shows the contents of a simple tab-delimited text file:

Pride and Prejudice<tab>Jane Austen<tab>used<tab>softcover
The Adventures of Huckleberry Finn<tab>Mark Twain<tab>new<tab>hardcover
The Art of War<tab>Sun Tzu<tab>used<tab>hardcover

The bold line is the header line, which determines the order of the information on subsequent lines. The first field in each line should always correspond to the first header (e.g., "Title" corresponds to Pride and Prejudice). The other headers and fields should match similarly.

It's important to note that tab characters aren't usually visible except as white space. Also, because fields are different lengths, a tab-delimited text file in a text editor will probably look more like this:

Title    Author    Binding   Condition
Pride and Prejudice     Jane Austen    used softcover
The Adventures of Huckleberry Finn     Mark Twain     new  hardcover
The Art of War     Sun Tzu   used hardcover

Without columns or tabs, it's difficult to see which text corresponds to which header. It's much easier to visualize in columns:

Title <tab> Author <tab> Condition <tab> Binding
Pride and Prejudice <tab> Jane Austen <tab> used <tab> softcover
The Adventures of Huckleberry Finn <tab> Mark Twain <tab> new <tab> hardcover
The Art of War <tab> Sun Tzu <tab> used <tab> hardcover
Spreadsheet programs help to create clear tab-delimited text files where each line of information takes up a row, and each field occupies a column:

      A B C D
1 Title Author Condition Binding
2 Pride and Prejudice Jane Austen used softcover
3 The Adventures of Huckleberry Finn Mark Twain new hardcover
4 The Art of War Sun Tzu used hardcover
Both Microsoft Excel and Google Spreadsheets are applications that allow you to convert spreadsheets into tab-delimited text files.

Mary is a Docs & Drive expert and author of this help page. Leave her feedback below about the page.

Was this article helpful?