This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Documentation / Mathematica / Built-in Functions / Graphics and Sound / Import and Export /


FilledSmallSquare Import["file.ext"] imports data from a file, assuming that it is in the format indicated by the file extension ext, and converts it to a Mathematica expression.

FilledSmallSquare Import["file", "format"] imports data in the specified format from a file.

FilledSmallSquare Import attempts to give a Mathematica expression whose meaning is as close as possible to the data in the external file.

FilledSmallSquare Import can handle numerical and textual data, graphics, sounds, material from notebooks, and general expressions in various formats.

FilledSmallSquare The following basic formats are supported for textual and tabular data:

FilledSmallSquare "Text" and "UnicodeText" return single Mathematica strings.

FilledSmallSquare "Lines" and "Words" return lists of Mathematica strings.

FilledSmallSquare "List" returns a list of Mathematica numbers or strings.

FilledSmallSquare "Table", "CSV" and "TSV" return a list of lists of Mathematica numbers or strings.

FilledSmallSquare In "List", "Table", "CSV" and "TSV" formats, numbers can be read in C or Fortran-like "E" notation.

FilledSmallSquare Numbers without explicit decimal points are returned as exact integers.

FilledSmallSquare In "Table" format, columns can be separated by spaces or tabs.

FilledSmallSquare In "Words" format, words can be separated by any form of white space.

FilledSmallSquare In "CSV" format, columns are taken to be separated by commas, unless other settings are specified using ConversionOptions.

FilledSmallSquare Import["file.txt"] uses "Text" format.

FilledSmallSquare Import["file.dat"] uses "Table" format.

FilledSmallSquare Import["file.csv"] uses "CSV" format.

FilledSmallSquare The following additional formats are also supported for numerical data:

FilledSmallSquare When appropriate, numerical data is imported as SparseArray objects.

FilledSmallSquare The following format yields a list of expressions suitable for input to NMinimize:

FilledSmallSquare Two-dimensional graphics formats are imported as Graphics objects; sound formats are imported as Sound objects.

FilledSmallSquare Animated graphics are imported as lists of Graphics objects.

FilledSmallSquare The following formats yield expressions of the form Graphics[data, opts]:

FilledSmallSquare The following formats yield expressions of the form Graphics[Raster[data], opts]:

FilledSmallSquare Imported raster data normally consists of integers; ColorFunction is often used to specify a color map.

FilledSmallSquare The following formats return objects of the form Graphics3D[data, opts]:

FilledSmallSquare The following formats yield expressions of the form Sound[SampledSoundList[data, r]]:

FilledSmallSquare The following gives a notebook expression Notebook[... ] from a Mathematica notebook file:

FilledSmallSquare The following XML formats give various types of expressions:

FilledSmallSquare With format "MathML", MathML presentation elements are if possible imported as mathematical expressions using TraditionalForm interpretation rules. Otherwise, they are imported as box expressions.

FilledSmallSquare With format "SymbolicXML", XML data of any document type is imported as a SymbolicXML expression.

FilledSmallSquare With format "XML", Import will recognize MathML, NotebookML, and ExpressionML and interpret them accordingly. Other XML will be imported as SymbolicXML.

FilledSmallSquare The following formats can be used for general expressions:

FilledSmallSquare The following general options can be given:

FilledSmallSquare Possible formats accepted by Import are given in the list $ImportFormats.

FilledSmallSquare Import["!prog", "format"] imports data from a pipe.

FilledSmallSquare See Section 1.11.3, Section 2.10.20 and Section 2.12.7.

FilledSmallSquare See also: Export, ImportString, $ImportFormats, ReadList.

FilledSmallSquare New in Version 4; modified in 5.0.

Additional Information