XLS (.xls)

Background

    Registered MIME type: application/vnd.ms-excel
    Microsoft Excel spreadsheet file.
    XLS is an acronym derived from Excel Spreadsheet.
    Stores spreadsheet data and formulas.

Import and Export

  • 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 and Export also handle embedded images.
  • 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.
  • The following expression types are supported by Export: Column, Grid, List, MatrixForm, Row, SparseArray, and TableForm.
  • 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 an 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.
  • ImportString and ExportString support the XLS format.

Elements

  • General Import elements:
  • "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
    "Images"embedded images as a list
  • Advanced data elements:
  • "FormattedData"data with some styling elements applied
  • See the reference page for "XLSX" for full documentation.

Examples

open allclose all

Basic Examples  (2)

Import the first sheet of an Excel file:

In[2]:=
Click for copyable input
Out[2]//TableForm=

Export a table to XLS:

In[1]:=
Click for copyable input
Out[1]=

Scope  (4)

See Also

"XLSX"  "MDB"  "CSV"  "TSV"

Introduced in 2004
(5.1)
| Updated in 2010
(8.0)