MathGroup Archive 2004

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

Search the Archive

Re: Excel formulas --> Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49146] Re: Excel formulas --> Mathematica
  • From: "Hans Michel" <hansjm at bellsouth.net>
  • Date: Mon, 5 Jul 2004 04:54:24 -0400 (EDT)
  • References: <cc0mbq$krt$1@smc.vnet.net>
  • Reply-to: "Hans Michel" <hansjm at bellsouth.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Frank:

This is a tall order. The following are suggestions. The only tested part I
did was saving excel spreadsheet to xml then Importing into Mathematica.
Also tried the html but found out it was not well formed.

First what platform are your running both Mathematica and Excel?

Second how would you do this in Excel with VBA or on a Macro Sheet?

The quick and dirty way you could do this if you had access to Excel 2003 or
XP and the workbook is to save them as *.xml format. If you know how to do
this from the command line then you never have to leave mathematica. I.E.,
!!excel.exe someswitch "file.xls" someswitch "output.xml".

Then use mathematica command to Import xml files
(Please check syntax I am not running Mathematica to check code)

Import["excelfilename.xm here with path info",  ConversionOptions ->
{"IncludeNamespaces" -> False}]

Cases[%, XMLElement["Cell",{Formula_},{_}],Infinity]

This will get you all cells that contain Formulas then you have to do
further processing to get the exact attributes.

Another way would be to Save your Excel Workbook as HTML file. Then Import
the file for text processing in Mathematica the key is to look for <td with
attributes of x:fmla="....". Unfortunately Excel HTML out put is not
well-formed xml.

Another suggesstion woulf be to use POI and J/Link. POI can read BIFF8.
(Platform indepent)

Another suggestion is to Use .NET/Link  and you would have access to the
excel Application Object or access to Office Web Component to open excel
spreadsheet and save as XML or HTML.

Hans


"Frank Brand" <fank.brand at t-online.de> wrote in message
news:cc0mbq$krt$1 at smc.vnet.net...
> Dear newsgroup members,
>
> is there a possibility to extract all formulas embedded in an Excel-file
> via a Mathematica command/function?
>
> Many thanks in advance
>
> Frank
>


  • Prev by Date: Re: Joining 2D arrays
  • Next by Date: Re: Periodic Table of Elements (Chemistry)
  • Previous by thread: Excel formulas --> Mathematica
  • Next by thread: Re: Excel formulas --> Mathematica