Dear John,
Try this:

require(RODBC)
spreadsheet <- "Sheet1"  # please change this to your needs
channel <-
odbcConnectExcel("i:\\all\\sorkinjohn\\stats\\silvermannatalie\\NEMOcombined06-24-09.xls")
mydata <- sqlFetch(channel, spreadsheet)
odbcClose(channel)
# attach(mydata)
mydata

HTH,

Jorge


On Thu, Jun 25, 2009 at 7:20 AM, John Sorkin <jsor...@grecc.umaryland.edu>wrote:

> R 2.8
> Windows XP
> Excel 2003
>
> I am trying to read an Excel spread sheet. I have looked at the RODBC help
> pages and am having trouble setting up code that will work. My code and the
> results are pasted below:
>
>
> >
> jo<-odbcConnectExcel("i:\\all\\sorkinjohn\\stats\\silvermannatalie\\NEMOcombined06-24-09.xls",readOnly
> = TRUE)
> > mo<-sqlGetResults(jo)
> > mo
> [1] -1
>
> I have tried to set up the connection string using odbcConnectExcel and
> then have tried to read the file using sqlGetResults. Can someone tell me
> what I am doing wrong?
>
> Thanks,
> John
>
> John David Sorkin M.D., Ph.D.
> Chief, Biostatistics and Informatics
> University of Maryland School of Medicine Division of Gerontology
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
> (Phone) 410-605-7119
> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
>
> Confidentiality Statement:
> This email message, including any attachments, is for ...{{dropped:13}}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to