[R] Excel *.xls files, RODBC

Dieter Menne dieter.menne at menne-biomed.de
Sat Dec 4 18:26:29 CET 2004


 
> library(RODBC)
> z <- odbcConnectExcel("c:/myfolder/mydata.xls")
> myframe <- sqlFetch(z, "Sheet1")
> close(z)

I found the reading of whole sheets somewhat unsafe, so I always create a named
range (here: data) including header and do the following. 
Never had problems with this.

channel = odbcConnectExcel("macronutrients.xls")
ac = sqlQuery(channel,"select * from data")
odbcClose(channel)


Dieter




More information about the R-help mailing list