Export Listing of Formats »


exports data to a file, converting it to the format corresponding to the file extension ext.


exports data in the specified format.


exports data by treating exprs as elements specified by elems.


  • Export handles a large number of formats, each typically with many different possible elements. The possible formats are given in the list $ExportFormats, and in the "Listing of All Formats".
  • Export["file.ext",expr] attempts to render expr in the appropriate format for the file. Among the possible forms for expr is normally the form that would be obtained from Import["file.ext"].
  • There are four common types of element specifications:
  • data representation specifications (e.g. "RawData", "Graphics")
    format specifications (e.g. "GIF", "GZIP", "XLS")
    options, properties, and settings (e.g. ImageSize, SampleRate)
    metadata information (e.g. "Comments")
  • In Export[file,exprs,elems], the elements can have the following basic forms:
  • "format"use the default element for the specified format
    elemexport a single element assuming the default format
    {"format",elem}export an element assuming the specified format
    {"comp1",,"format",}use also compression formats "compi" (e.g. "GZIP")
    {elem1,{elem11,elem12,}}export the expri as subelements elem1i of elem1
  • Forms of elements often supported include:
  • "Audio"give sound as an Audio object
    "Data"give data in a generic form (list, string, etc.)
    "Graphics"give graphics or geometry as a Graphics object
    "Graphics3D"give 3D graphics or geometry as a Graphics3D object
    "Grid"give a grid of data as a list or a Grid, etc.
    "Image"give images as Image objects
    "Rules"give explicit rules for elements to export
  • With the "Rules" element specification, the rules in exprs can have the following basic forms:
  • elem->vala value for a single element
    {elem1->val1,elem2->val2,}values for several elements
    elem1->val1,elem2->val2,an association for several elements
    elem1->{elem11->val11,}values for subelements
  • Export["!prog",expr,] exports data to a pipe.
  • Many options can be given using Export[file,exprs,elems,opts].
  • The names of options specific to particular formats and elements are normally strings.
  • Typical general options include Background, CharacterEncoding, ImageSize, ImageResolution, ImageFormattingWidth, SampleRate, etc.
  • Export[file,NotebookObject[],] when possible exports the content of the notebook referenced by the NotebookObject.
  • Export can be used to export data to cloud and local objects.
  • Export works with File objects.


open allclose all

Basic Examples  (4)

Export an image object:

Click for copyable input

Export a plot as a GIF:

Click for copyable input

Export a formula as a GIF:

Click for copyable input
Click for copyable input

Export a sound as a MIDI file:

Click for copyable input

Generalizations & Extensions  (2)

See Also

Import  ExportString  $ExportFormats  CloudExport  Write  BinaryWrite  Put  Rasterize  ExportForm  DumpSave  SendMail


Introduced in 1999
| Updated in 2017