This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
Mathematica Import/Export Format

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 fully support the TSV format and provide various data conversion and formatting options.
  • Import automatically recognizes common number formats, including C and Fortran notations.
  • Numbers without decimal points are imported as integers.
  • Import["file.tsv"] imports a TSV file, returning a list of lists.
  • Export["file.tsv", expr] exports a two-dimensional array to a TSV file.
  • Import["file.tsv"] returns a two-dimensional array of strings and numbers, representing the rows and columns stored in the file.
  • Export["file.tsv", expr] creates a TSV file from an array expr, using the CForm of non-numeric table elements.
  • Mathematica automatically transforms arbitrary expressions to a list of lists when exporting to TSV.
  • Import["file.tsv", elem] imports the specified element from a TSV file.
  • Import["file.tsv", {elem, suba, subb, ...}] imports a subelement.
  • Import["file.tsv", {{elem1, elem2, ...}}] imports multiple elements.
  • The import format can be specified with Import["file", "TSV"] or Import["file", {"TSV", elem, ...}].
  • Export["file.tsv", expr, elem] creates a TSV file by treating expr as specifying element elem.
  • Export["file.tsv", {expr1, expr2, ...}, {{elem1, elem2, ...}}] treats each expri as specifying the corresponding elemi.
  • Export["file.tsv", expr, opt1->val1, ...] exports expr with the specified option elements taken to have the specified values.
  • Export["file.tsv", {elem1->expr1, elem2->expr2, ...}, "Rules"] uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
  • Save Selection As exports the selected part of a notebook as a TSV file.
"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
  • Data representation elements:
"Data"two-dimensional array, representing the rows and columns of a TSV file
"Grid"table data as a Grid object
AlignmentNonehow data is aligned within table columns
CharacterEncoding"UTF8"raw character encoding used in the file
CharacterEncoding"ASCII"raw character encoding used in the file
"EmptyField"""how to represent empty fields
"TextDelimiters"Automaticstring or list of strings used to delimit non-numeric fields
  • By default, Export delimits text fields containing tab characters with double-quote characters.
  • With an explicit setting of "TextDelimiters", Export always uses the specified string tokens to delimit text fields, effectively cycling through the list of delimiters.
  • "TextDelimiters" -> "\"" puts double-quotes around each text field when exporting to TSV.
  • With "TextDelimiters" -> {"(", ")"} , Export wraps each text field in parentheses.
  • Double-quote characters delimiting text fields are not imported by default.
"CurrencyTokens"{{"$", "£", "¥", "€"}, {"c", "¢", "p", "F"}}currency units to be skipped when importing numerical values
"DateStringFormat"Nonedate format, given as a DateString specification
"Numeric"Truewhether to import data fields as numbers if possible
"IgnoreEmptyLines"Falsewhether to ignore empty lines
"NumberPoint""."string to use for a decimal point
"NumberSigns"{"-","+"}strings to use for signs of negative and positive numbers
"HeaderLines"0number of lines to skip at the beginning of the file
  • Import converts table entries formatted as specified by the "DateStringFormat" option to a DateList representation of the form {y, m, d, h, m, s}.
  • With "Numeric" -> False, numbers will be imported as strings in the form they appear in the file.
  • Import automatically recognizes all common conventions for the encoding of line separator characters.
"TableHeadings"Noneheadings for table columns and rows
  • "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 Mathematica is being run.