[R] odbcConnectExcel() fails to fetch all columns

Andrew Roberts andrew at thinkingbone.org
Fri Apr 20 21:46:36 CEST 2012


Folks,

Is there a parameter somewhere in RODBC that enables more columns to be 
retrieved from an Excel worksheet?

# This next bit uses an undocumented call in RODBC
z <- odbcConnectExcel("./BBaselinePtQaires_apr2011.xls")
BQ <- sqlFetch(z, "BBaselinePtQaires")

Gives me:

z RODBC[1]

And

BQ 134 obs. of 59 variables

I have all the rows in the worksheet but only the first 59 out of a 
total of 70 columns. I’m in RStudio 0.95.263 using RODBC 1.3-3 and R 
version 2.12.2 (2011-02-25).

I'm puzzled - the worksheet seems ok. If the worst comes to the worst I 
will have to split the worksheet and cbind to put it back together but 
that seems inelegant. The worksheet contains 134 rows, 70 columns and is 
in a spreadsheet that weighs in at 154 KB in total.

Can you help unbaffle me?

Andrew



More information about the R-help mailing list