TSV (.tsv)


    MIME type: text/tab-separated-values
    TSV tabular data format.
    Stores records of numerical and textual information as lines, using tab characters to separate fields.
    TSV is an acronym for Tab-Separated Values.
    Plain text format.
    Similar to CSV.

Import and Export

  • Import["file.tsv"] returns a list of lists containing strings and numbers, representing the rows and columns stored in the file.
  • Import["file.tsv",elem] imports the specified element from a TSV file.
  • Import["file.tsv",{elem,sub1,}] imports subelements, specifically useful for partial data import.
  • The import format can be specified with Import["file","TSV"] or Import["file",{"TSV",elem,}].
  • Export["file.tsv",expr] creates a TSV file from expr, using the InputForm of non-numeric elements at the second level.
  • Export["file.tsv",expr] also works for structured input such as Dataset and TimeSeries.
  • See the reference pages for full general information on Import and Export.
  • ImportString and ExportString support the TSV format.

Notebook Interface

  • Save Selection As exports the selected part of a notebook as a TSV file.


  • General Import elements:
  • "Elements"list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties, and settings
    "Summary"summary of file size and dimensions
  • Data representation elements:
  • "Data"two-dimensional array
    {"Data",rows,cols}imports specified rows and columns
    "Grid"table data as a Grid object
    "RawData"two-dimensional array of strings
    {"RawData",rows,cols}imports raw data from specified rows and columns
    "Dataset"table data as a Dataset
  • Import and Export use the "Data" element by default.
  • Part specification rows and cols can be any of the following:
  • nnth row or column
    {n1,n2,}specific rows or columns ni
  • Dimension elements:
  • "RowCount"number of rows
    "MaxColumnCount"maximum number of columns


  • Import and Export options:
  • CharacterEncodingAutomaticraw character encoding used in the file
    "EmptyField"""how to represent empty fields
    "TextDelimiters""\""character used to delimit non-numeric fields
  • By default, Import attempts to interpret the data as "UTF8" encoded text. If any sequence of bytes stored in the file cannot be represented in "UTF8", Import uses "ISOLatin1" instead.
  • Export by default creates a "UTF8" encoded file.
  • Data fields containing tab characters and line separators are typically wrapped in double-quote characters. By default, Export uses double-quote characters as delimiters. Specify a different character using "TextDelimiters".
  • Double-quote characters delimiting text fields are not imported by default.
  • Import option:
  • "CurrencyTokens"{{"$", "£", "¥", "€"}, {"c", "¢", "p", "F"}}currency units to be skipped when importing numerical values
    "DateStringFormat"Nonedate format, given as a DateString specification
    "FillRows"Automaticwhether to fill all rows to the maximum column length
    "HeaderLines"0number of lines to assume as headers
    "IgnoreEmptyLines"Falsewhether to ignore empty lines
    "Numeric"Automaticwhether to import data fields as numbers if possible
    "SkipLines"0number of lines to skip at the beginning of the file
  • Possible settings for "HeaderLines" and "SkipLines" are:
  • nn rows to skip or to use as Dataset headers
    {rows,cols}rows and columns to skip or to use as headers
  • Import converts table entries formatted as specified by "DateStringFormat" to a DateObject.
  • Export options:
  • AlignmentNonehow data is aligned within table columns
    "TableHeadings"Noneheadings for table columns and rows
  • Possible settings for Alignment are None, Left, Center, and Right.
  • "TableHeadings" can be set to the following values:
  • Noneno labels
    Automaticgives successive integer labels for columns and rows
    {"col1","col2",}list of column labels
    {rhead,chead}specifies separate labels for the rows and columns
  • Export encodes line-separator characters using the convention of the computer system on which the Wolfram Language is being run.


open allclose all

Basic Examples  (2)

Import a TSV file:

Click for copyable input

Export an array of expressions to TSV:

Click for copyable input
Click for copyable input

Scope  (5)

Import Elements  (13)

Import Options  (10)

Export Options  (6)

Applications  (1)

Possible Issues  (2)

See Also

"CSV"  "Table"  "XLS"  "Ini"

Introduced in 1999
| Updated in 2017