Importing and Exporting Data

Import["file","Table"]import a table of data from a file
Export["file",list,"Table"]export list to a file as a table of data

Importing and exporting tabular data.

This exports an array of numbers to the file out.dat:
Click for copyable input
Here are the contents of the file out.dat:
Click for copyable input
This imports the contents of out.dat as a table of data:
Click for copyable input

Import["file","Table"] will handle many kinds of tabular data, automatically deducing the details of the format whenever possible. Export["file",list,"Table"] writes out data separated by tabs, with numbers given in C or Fortranlike form, as in 2.3E5 and so on.

Import["name.ext"]import data assuming a format deduced from the file name
Export["name.ext",expr]export data in a format deduced from the file name

Importing and exporting general data.

table formats"CSV", "TSV", "XLS"
matrix formats"HarwellBoeing", "MAT", "MTX"
specialized data formats"DIF", "FITS", "HDF5", "MPS", "SDTS", etc.

Some common formats for tabular data.

Import and Export can handle not only tabular data, but also data corresponding to graphics, sounds, expressions and even whole documents. Import and Export can often deduce the appropriate format for data simply by looking at the extension of the file name for the file in which the data is being stored. "Exporting Graphics and Sounds" and "Importing and Exporting Files" discuss in more detail how Import and Export work. Note that you can also use Import and Export to manipulate raw files of binary data.

This imports a graphic in JPEG format:
Click for copyable input
$ImportFormatsimport formats supported on your system
$ExportFormatsexport formats supported on your system

Finding the complete list of supported import and export formats.