0
votes

I have multiple workbooks with multiple worksheets. In each worksheet, the data starts from a different row number, but can be identified when "ABCD" occurs in the 1st column. I want to apply a function/calculation to each worksheet. However, as the first step, I cannot read in the workbook as a data frame. Tried XLConnect but getting the following error

*(Error in ls(envir = envir, all.names = private) : 
  invalid 'envir' argument*

My question is how do I read the data from each worksheet into a data frame?

2
Show the code that was used.IRTFM
Unless you've defined envir, the object envir doesn't yet exist. Maybe you want something like ls(envir = .GlobalEnv, ...)Rich Scriven

2 Answers

0
votes

Try the RODBC package http://cran.r-project.org/package=RODBC

See also: http://cran.r-project.org/doc/manuals/r-release/R-data.html#Reading-Excel-spreadsheets

0
votes

XLConnect doesn't work on large EXCEL files. I used RODBC to get it working. See code in the following link if interested. Here's the link:

(Read data from several worksheets from workbook and eliminate comments).

Make sure that the R version, Operating system and MS Office versions (64 bit or 32-bit) are identical.