The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Export Data from Mathematica to Excel
Replies: 8   Last Post: Oct 20, 2012 1:56 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Murray Eisenberg

Posts: 2,105
Registered: 12/6/04
Re: Export Data from Mathematica to Excel
Posted: Oct 20, 2012 3:23 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Oct 19, 2012, at 2:43 AM, wrote:

> ...What about exporting financial data to excel?
> say
> MS=DateListPlot[FinancialData["MS", "Jan. 1, 2007]]
> I get this plot of Morgan Stanley daily price over the last 5 years.
> But exporting it using the following fails:
> Export["mfile_ms.xls", MS]
> it returns
> Failed
> Export::fmterr : Invalid XLS format.

First, you have a syntax in the FinancialData expression: there's a missing close-quotes. Fix that.

Next, do you want to export the data itself, or just the plot you created? If the former, then:

data = FinancialData["MS", "Jan. 1, 2007"]
Export["data.xls", data]

If the latter, then use the "Images" option:

MS=DateListPlot[FinancialData["MS", "Jan. 1, 2007"]]
Export["images.xls", {}, "Images" -> MS]

Instead of the second argument {}, you could include data. In any case, the exported graphic will be in a second sheet of the Excel spreadsheet. That second argument, for reasons I don't understand, seems to be necessary.
Murray Eisenberg
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2838 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.