[R] Problems reading excel file with RODBC connect

Luis Felipe Parra felipe.parra at quantil.com.co
Thu Mar 31 05:08:31 CEST 2011


Hello, I am trying to read an Excel file using RODBC connect (its attached)
using the following code:

  Data<-odbcConnectExcel2007('acciones_col.xlsx',readOnly=T,)
  datos<-sqlFetch(Data,'Bloomberg')
  odbcClose(Data)

The file contains stock data downloaded from bloomberg, and it contains five
variables per stock (so every five columns there is an empty column) . As
the bloomberg output comes, in the first row there are the stock names (but
in between each stock name there are five empty cells). The second row
contains the variables names (every 5 cells there is an empty cell). From
the third row onwards the actual data appears. The actual file has 473
columns but i am only getting R to read 255.

I know files with to many missings can be troublesome. Is there a way to
tell R how many colums to read? Or does anybody know how can I sort out this
problem.

Thank you

Felipe Parra


More information about the R-help mailing list