[R] 64 bit use of odbcConnectExcel

Jack T. jackt at fpc.org
Thu Jul 22 18:14:23 CEST 2010


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.



More information about the R-help mailing list