MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Export Data from Mathematica to Excel

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128450] Re: Export Data from Mathematica to Excel
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Sat, 20 Oct 2012 00:34:05 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <fq3amk$fu4$1@smc.vnet.net> <20121019064324.109BD68EA@smc.vnet.net>

On Oct 19, 2012, at 2:43 AM, minscheung at 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 at 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








  • Prev by Date: Re: Export Data from Mathematica to Excel
  • Next by Date: Re: Filling between lines in ListPlot not working
  • Previous by thread: Re: Export Data from Mathematica to Excel
  • Next by thread: Re: Export Data from Mathematica to Excel