Try using odbcConnectExcel2007, instead of odbcConnectExcel. That has worked for me.
Cheers, Mike. > Message: 60 > Date: Thu, 22 Jul 2010 09:14:23 -0700 (PDT) > From: "Jack T." <ja...@fpc.org> > To: r-help@r-project.org > Subject: [R] 64 bit use of odbcConnectExcel > Message-ID: <1279815263840-2298927.p...@n4.nabble.com> > Content-Type: text/plain; charset=us-ascii > > > Hi All, > > I'm using R 2.11.1 on 64 bit windows XP. The little function I wrote below > I use often to import the first 1001 lines in an excel sheet to R. This > works fine on the 32 bit version of R but fails on the 64 bit [both on the > same machine, using the same function, importing the same .xls file]. The > message from 64 bit R is: > > Error in sqlTables(channel1) : > first argument is not an open RODBC channel > In addition: Warning messages: > 1: In odbcDriverConnect(con, tabQuote = c("[", "]"), ...) : > [RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver > Manager] Data source name not found and no default driver specified > 2: In odbcDriverConnect(con, tabQuote = c("[", "]"), ...) : > ODBC connection failed > > > I've also tried functions in the xlsReadWrite library. Is reading .xls > files just something that the 64-bit R can't do yet? I would prefer to use > 64 bit R all of the time because it makes use of all the RAM on my computer > (> 4 gig) and for files with millions of rows this is useful but it seems it > is still under development. For now I switch back an forth between 64 bit > and 32 bit depending on what I'm working on. > > Any suggested solutions for xls import problems? > > My function > get.xls.file <- function(xlsfile){ > library(RODBC) > #xlsfile <- file.choose() > channel1 <- odbcConnectExcel(xlsfile) > a <- sqlTables(channel1) > b <- nchar(a$TABLE_NAME[1]) > x <- substring(a$TABLE_NAME[1], 2, b-2) > data <- sqlFetch(channel1, x, max=1001) > odbcCloseAll() > return(data) > } > > > JT > -- > View this message in context: > http://r.789695.n4.nabble.com/64-bit-use-of-odbcConnectExcel-tp2298927p2298927.html > Sent from the R help mailing list archive at Nabble.com. Michael Sumner Institute for Marine and Antarctic Studies, University of Tasmania Hobart, Australia e-mail: mdsum...@utas.edu.au ______________________________________________ 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.