[R] how to extract data from excel sheet?

Chuck Cleland ccleland at optonline.net
Thu Aug 19 13:08:35 CEST 2004


   Here is one way to read the "mysheet1" worksheet from the 
"mydata.xls" file:

library(RODBC)
          z <- odbcConnectExcel("c:\\mydata.xls")
    myframe <- sqlFetch(z, "mysheet1")
    close(z)

   Your data will be in myframe.  Thanks to Michael Lapsley 
and Brian Ripley for the RODBC package.  See the "R Data 
Import/Export" manual for more information.

Sivan Aldor wrote:
> i want to upload different sheets from one excel file.
> does anyone know of a way to do so? (i use read.csv to load the excel but
> i would like to load form the sheets themselves.)

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894




More information about the R-help mailing list