[R] Reading Excel files from within R.

Dirk Eddelbuettel edd at debian.org
Thu Jan 11 06:14:27 CET 2001


  Alistair>  Dear all, I am interested in reading Excel spreadsheets (*.xls)
  Alistair> directly into R (I am using version 1.1.1 at the moment). I have
  Alistair> not had much luck so far.

As you probably know, Excel is not exactly an open source program. Further,
there is little available documentation on the .xls file format, and no
guarantee whatsoever that it won't change once you figured one version out.
In short, not a promising avenue for open source.

That being said, there are few choices

a) a little bit of alpha-stage code in the CPAN (i.e. Perl) archives for both
reading (Spreadsheet-ParseExcel) and writing Excel (Spreadsheet-WriteExcel,
this also has a few more references) spreadsheets

b) the ActiveState Perl implementation for Windows can read .xls files by
"driving" Excel through OLE, this does of course require Excel on a Windoze
machine

c) a little while ago Brian Ripley posted on the list how he used ODBC to
read from .xls files 

d) lastly, the Gnumeric spreadsheet knows how to read .xls files, you could try
to learn from its code and create a R function read.xls if you truly need
this.

Take your pick. Saving as .csv still seems like the easiest solution to me
though I also do a bit of b).

Hope this helps,  Dirk

-- 
According to the latest figures, 43% of all statistics are totally worthless.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list