Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12123

Re: Export Data from Mathematica to Excel

From Murray Eisenberg <murray@math.umass.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Export Data from Mathematica to Excel
Date 2012-10-20 07:23 +0000
Message-ID <k5tjhd$3hb$1@smc.vnet.net> (permalink)
References <fq3amk$fu4$1@smc.vnet.net> <20121019064324.109BD68EA@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


On Oct 19, 2012, at 2:43 AM, minscheung@googlemail.com 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                                    
murray@math.umass.edu
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





Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Export Data from Mathematica to Excel Murray Eisenberg <murray@math.umass.edu> - 2012-10-20 07:23 +0000

csiph-web