This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
How to | Export a Spreadsheet
You may want to export data from Mathematica to a spreadsheet. Excel is one example of a common spreadsheet format that Mathematica supports.
This is a selection of examples from the complete "How to" screencast. »
Use Table with two variables to set up a table of values (stored as ):
In[1]:=
Click for copyable input
Out[1]=
To view your data as it will appear in a spreadsheet, display it in TableForm:
In[2]:=
Click for copyable input
Out[2]//TableForm=
Use Export to export the data to Excel format ("XLS") with the file name you specify:
In[3]:=
Click for copyable input
Out[3]=
You can leave out the format if you specify the file extension:
In[4]:=
Click for copyable input
Out[4]=
To view your spreadsheet, open the file with Excel or any other compatible spreadsheet program.
To make the rows of the spreadsheet appear in columns, and vice versa, use Transpose.
In[5]:=
Click for copyable input
Out[5]=
Mathematica also allows you to export data to multiple individual spreadsheets in a single Excel file.
Set up some more data to export and display it in TableForm:
In[3]:=
Click for copyable input
Out[3]=
In[4]:=
Click for copyable input
Out[4]//TableForm=
Place the datasets in a list to export them to separate spreadsheets in a single Excel file:
In[8]:=
Click for copyable input
Out[8]=
The sheets are by default named Sheet1 and Sheet2. You can also specify the names of the sheets:
In[17]:=
Click for copyable input
Out[17]=
Use Export to move transposed data to separate, named sheets:
In[43]:=
Click for copyable input
Out[43]=