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 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. [[alternative HTML version deleted]]
On Wed, Jun 16, 2010 at 7: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 > > Question *1) What is the way to get it working?*Works for me on an Ubuntu 9.10 with R 2.10.1, so swapping your OS and R version to that will get it working... What OS/R are you on? Note it says 'perl not found'. That's because it hasn't found perl. Do you have perl on your system? Do you need to specify the path to perl, as in the examples for Windows in help(read.xls)? Barry
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' argumentEither 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