This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
imports data from a file, returning a complete Mathematica version of it.
Import["file", elements]
imports the specified elements from a file.
Import["http://url", ...] and Import["ftp://url", ...]
imports from any accessible URL.
  • The format of a file is by default deduced from the file extension in its name, or by FileFormat from its contents.
  • Import elements determine which aspects of a file should be imported, and how they should be returned to Mathematica.
  • The following forms of element specifications can be given:
"format"take the file to be in the specified format
elemimport a single element assuming the default format
{"format",elem}import an element assuming the specified format
{"comp1",...,"format",...}assume also compression formats "compi" (e.g. "GZIP")
{elem1,elem11}import subelement elem11 of elem1
{elem1,elem11,...}import subelements of subelements
{elem1,{elem11,elem12,...}}import several subelements of elem1
{elem1,n}import the nth part of elem1
  • Types of elements typically supported include:
"Elements"a list of names of elements
"Rules"rules for the values of all elements
"Options"rules for options, settings, meta-information, etc.
"Data"data in a generic Mathematica form (list, string, etc.)
"RawData"raw data as used in the format (e.g. indexed colors)
"Graphics"2D graphics (for graphical or geometry formats)
"Graphics3D"3D graphics (for graphical or geometry formats)
"Sound"sound (for sound formats)
"Plaintext"plain text (for textual formats)
"Grid"grid format (for arrays, spreadsheets, etc.)
  • If no element specification is given, Import will typically return expressions that display or operate as much as possible as they would in an external viewer of the file being imported. Graphical formats, for example, are by default returned as Graphics or Graphics3D expressions.
  • For some formats, there are options that specify details of how the import process should be performed; these are given as Import[source, elems, opts].
  • Import["file", ..., Path->path] searches for file on the specified path.
  • Import["!prog", "format"] imports data from a pipe.
  • When importing from a remote URL, Import uses whatever proxy and related settings are specified in your environment, but not cookies or other authentication.
New in 4 | Last modified in 6