Try this:


library(RDCOMClient)

xl <- COMCreate("Excel.Application")
xl$Workbooks()$Open("teste.xls")$Sheets()$Count()


On Thu, Jul 2, 2009 at 11:22 AM, Lauri Nikkinen <lauri.nikkinen@iki.fi>wrote:

> Hi,
>
> I'm trying to read several Excel sheets from an Excel file into a
> list. I'm using
> read.xls from package 'gdata'. I would like to know how I can
> check the number of sheets before the loop (in the example below) so
> that I could adjust the loop counter? Any suggestions?
>
> DF.list <- list()
> for (i in 1:4) {
>    DF.list[[i]] <- read.xls("sample_file.xls", sheet=i,
> stringsAsFactors = FALSE)
>    }
>
> Thanks,
> -L
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]


