Listing of Formats »


imports data from a file, returning a complete Wolfram Language version of it.


imports the specified elements from a file.

Import["http://url",] and Import["ftp://url",]

import from any accessible URL.


  • Import handles a large number of formats, each typically with many different possible elements. The possible formats are given in the list $ImportFormats, and in the guide "Listing of All Formats".
  • 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 the Wolfram Language.
  • 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 Wolfram Language 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)
    "Audio"audio (from audio 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].
  • Names of Export options such as ImageSize can be given as elements for Import.
  • 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 that controls how the Wolfram System authenticates the identity of a server when establishing a network connection. By default, the Wolfram System uses interactive authentication if necessary. With a setting "ServerAuthentication"->False, the Wolfram System connects to the server without authentication. With "ServerAuthentication"->True, the Wolfram System only connects to servers whose authenticity has been previously established.
  • Import works with cloud and local objects.
  • Import works with File and URL objects.


open allclose all

Basic Examples  (3)

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

Scope  (2)

Generalizations & Extensions  (2)

Options  (2)

See Also

Export  ImportString  SemanticImport  Interpreter  $ImportFormats  CloudImport  NotebookImport  ReadList  BinaryReadList  ReadString  ReadLine  FileFormat  FilePrint


Related Workflows

Introduced in 1999
| Updated in 2018