此为 Mathematica 8 文档,内容基于更早版本的 Wolfram 语言
查看最新文档(版本11.1)

XLSX (.xlsx)

Registered MIME type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Microsoft Excel spreadsheet file.
Standard format of Excel 2007 and higher.
Also known as Office Open XML.
XLSX is an acronym derived from Excel Spreadsheet.
XML-based file bundle.
Stores data, formulas, and graphics.
  • Import and Export are fully compatible with the Excel 2007 standard.
  • Import imports all sheets of an XLSX file, returning the result as a list of arrays.
  • Export exports an array or a list of arrays to XLSX.
  • Import["file.xlsx"] returns the sheets of an XLSX file as an expression of the form where the are full arrays containing numerical and textual data, Boolean values, and date specifications.
  • Export["file.xlsx", expr] creates an XLSX file from array data.
  • Import imports the specified element from an XLSX file.
  • Import imports multiple elements.
  • The import format can be specified with Import["file", "XLSX"] or Import.
  • Export creates an XLSX file by treating expr as specifying element elem.
  • Export treats each as specifying the corresponding .
  • Export exports expr with the specified option elements taken to have the specified values.
  • Export 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 formulas as text
"Images"embedded images as a list
  • Advanced data elements:
"FormattedData"data with some styling elements applied
  • XLSX data is represented in Mathematica by real or integer numbers, strings, Boolean values True and False, and DateList specifications.
  • XLSX error cells are imported as $Failed.
  • Import gives the Excel formulas for each cell in the form where the are arrays corresponding to the sheets of an XLSX 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 of the k^(th) sheet
  • Import 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 in sheet name
  • Import yields spreadsheets as full rectangular arrays.
  • Export supports full and ragged arrays.
"EmptyField"""how empty cells are represented in Mathematica
"ImageFormat""JPEG"format used for exporting images
Import the first sheet of an XLSX file:
Import an embedded image from an XLSX file:
Export the first 12 prime numbers to a spreadsheet:
Export data again with a header row:
Export two datasets to different sheets:
Show the Import elements in a file:
Specify sheet names:
Import the cell at row 1, column 4, for a given sheet:
Import the second sheet:
Export and import hyperlinks:
Export date and date-time stamps:
Import converts the dates into the DateList form:
Export raster images to XLSX (automatically rasterizing vector graphics):
Import returns a list of images:
Raw bytes representing common image file formats can also be exported as images to XLSX:
Import the first sheet of an XLSX file:
In[1]:=
Click for copyable input
Out[1]=
 
Import an embedded image from an XLSX file:
In[1]:=
Click for copyable input
Out[1]=
 
Export the first 12 prime numbers to a spreadsheet:
In[1]:=
Click for copyable input
Out[1]=
Export data again with a header row:
In[2]:=
Click for copyable input
Out[2]=
 
Export two datasets to different sheets:
In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=
Show the Import elements in a file:
In[1]:=
Click for copyable input
Out[1]=
 
Specify sheet names:
In[1]:=
Click for copyable input
Out[1]=
Import the cell at row 1, column 4, for a given sheet:
In[2]:=
Click for copyable input
Out[2]=
Import the second sheet:
In[3]:=
Click for copyable input
Out[3]=
 
Export and import hyperlinks:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
Export date and date-time stamps:
In[1]:=
Click for copyable input
Out[1]=
Import converts the dates into the DateList form:
In[2]:=
Click for copyable input
Out[2]=
 
Export raster images to XLSX (automatically rasterizing vector graphics):
In[1]:=
Click for copyable input
Out[1]=
Import returns a list of images:
In[2]:=
Click for copyable input
Out[2]=
 
Raw bytes representing common image file formats can also be exported as images to XLSX:
In[1]:=
Click for copyable input
Out[1]=