Author Login
Post Reply
If you are on Windows and have Excel on the same machine
then the code here:
http://tolstoy.newcastle.edu.au/R/e6/help/09/03/7736.html
will return the number of worksheets as well as a vector of
the worksheet names.
It seems that the email has somehow caused some of the
lines to wrap so you will have to correct that.
There is also some info on various methods of reading excel
spreadsheets here:
http://wiki.r-project.org/rwiki/doku.php?id=tips:data-io:ms_windows
On Thu, Jul 2, 2009 at 10:22 AM, Lauri Nikkinen<lauri.nikkinen@(protected):
> 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@(protected)
> 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.
>
______________________________________________
R-help@(protected)
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.