This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
Mathematica Import/Export Format

XLS (.xls)

Registered MIME type: application/vnd.ms-excel
Microsoft Excel spreadsheet file.
XLS is an acronym for Excel Spreadsheet.
Commonly used for storage and exchange of spreadsheet data and formulas.
  • Import supports XLS files created by Excel 95, 97, 2000, XP, and 2003.
  • Export creates Excel 2000 files.
  • Import["file.xls"] imports all sheets of an XLS file, returning the result as a list of arrays.
  • Export["file.xls", expr] exports an array or a list of arrays to XLS.
  • Import["file.xls"] returns the sheets of an XLS file as an expression of the form {s1, s2, ...} where the si are full arrays containing numerical and textual data, Boolean values, and date specifications.
  • Export["file.xls", expr] creates an XLS file from array data.
  • Import["file.xls", elem] imports the specified element from an XLS file.
  • Import["file.xls", {elem, suba, subb, ...}] imports a subelement.
  • Import["file.xls", {{elem1, elem2, ...}}] imports multiple elements.
  • The import format can be specified with Import["file", "XLS"] or Import["file", {"XLS", elem, ...}].
  • Export["file.xls", expr, elem] creates a XLS file by treating expr as specifying element elem.
  • Export["file.xls", {expr1, expr2, ...}, {{elem1, elem2, ...}}] treats each expri as specifying the corresponding elemi.
  • Export["file.xls", expr, opt1->val1, ...] exports expr with the specified option elements taken to have the specified values.
  • Export["file.xls", {elem1->expr1, elem2->expr2, ...}, "Rules"] uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
"Elements"list of elements and options available in this file
"Rules"full list of rules for each element and option
"Options"list of rules for options, properties and settings
  • Data representation elements:
"Data"list of full arrays, representing all sheets
"Formulas"all XLS formulas as text
  • XLS data is represented in Mathematica by real or integer numbers, strings, Boolean values True and False, and DateList specifications.
  • XLS error cells are imported as $Failed.
  • Import["file.xls","Formulas"] gives the Excel formulas for each cell in the form {f1, f2, ...} where the fi are arrays corresponding to the sheets of an XLS file.
  • Importing parts of a data sheet:
"Data",kthe k^(th) sheet, given as an array
"Data",k, mrow m of the k^(th) sheet
"Data",k, m, ncell {m, n} of the k^(th) sheet
  • Import["file.xls", {"Data", 1}]returns the first sheet as an array.
  • The following can be used to select or specify individual sheets by name:
"Sheets"list of sheet names
"Sheets", namesheet name as an array
"Sheets", name, mrow m of sheet name
"Sheets", name, m, ncell {m, n} in sheet name
  • Import yields spreadsheets as full rectangular arrays.
  • Export supports full and ragged arrays.
"EmptyField"""how empty cells are represented in Mathematica