This is documentation for Mathematica 7, 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 n^(th) 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)
"Image"raster image (for graphical formats)
"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 URL, Import can handle http, https, and ftp.
  • Import uses proxy and related settings specified in Preferences settings in the notebook front end, or in your operating system environment.
  • Import generates a dialog if interactive authentication is required.
  • Import takes a "ServerAuthentication" option which controls how Mathematica authenticates the identity of a server when establishing a network connection. By default Mathematica uses interactive authentication if necessary. With a setting "ServerAuthentication" -> False, Mathematica connects to the server without authentication. With "ServerAuthentication" -> True, Mathematica only connects to servers whose authenticity has been previously established.
Import a complete GIF image file as an image object:
Find what elements are available to import:
Import the image size:
Import a complete GIF image file as an image object:
Click for copyable input
Find what elements are available to import:
Click for copyable input
Import the image size:
Click for copyable input
Import the complete array of data:
Extract information for one part of the array:
Extract the part directly:
New in 4 | Last modified in 7