[R] 64 bit use of odbcConnectExcel

mdsumner Michael.Sumner at utas.edu.au
Fri Jul 23 16:00:18 CEST 2010


 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." <jackt at fpc.org>
> To: r-help at r-project.org
> Subject: [R] 64 bit use of odbcConnectExcel
> Message-ID: <1279815263840-2298927.post at 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: mdsumner at utas.edu.au



More information about the R-help mailing list