[R] Reading data from xls..........please help

Gabor Grothendieck ggrothendieck at gmail.com
Wed Jun 16 21:28:33 CEST 2010


On Wed, Jun 16, 2010 at 2:29 PM, Christofer Bogaso
<bogaso.christofer at gmail.com> wrote:
> Can anyone help me how to read xls file into R. I have tried following
>
> library(gdata)
> xlsfile <- file.path(.path.package('gdata'),'xls','iris.xls')
> read.xls(xlsfile)
>
> I got following error:
> Converting xls file to csv file... Error in system(cmd, intern = !verbose) :
> perl not found
> Error in file.exists(tfn) : invalid 'file' argument

Either you don't have perl or you do have it but it can't find it
since its not on your path.  You can either add perl to your path or
use the perl= argument to give it the path.  See ?read.xls and note
the examples in the example section at the bottom.

>
> Question *1) What is the way to get it working?*
>
>
> 2nd approach I done was with RODBC package:
>
> library(RODBC)
> odbcConnectExcel(xlsfile)
>
> Here I got following report:
>
> RODBC Connection 4
> Details:
>  case=nochange
>  DBQ=C:\PROGRA~1\R\R-211~1.1\library\gdata\xls\iris.xls
>  DefaultDir=C:\PROGRA~1\R\R-211~1.1\library\gdata\xls
>  Driver={Microsoft Excel Driver (*.xls)}
>  DriverId=790
>  MaxBufferSize=2048
>  PageTimeout=5
>
> My question is *2) How I retrieve data here?*
> *
> *
> Thanks for your time.
>

Read the documentation that comes with RODBC:
vignette("RODBC", package = "RODBC")

Also there is a list of many alternatives here:
http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows&s=excel



More information about the R-help mailing list