According to the docs: getSheets() returns a list of java object references each pointing to an worksheet.
...and the Examples section of the help page shows you how to work with that. Can't tell whether the methods cover what you need though. B. On Apr 17, 2016, at 5:36 PM, Val <valkr...@gmail.com> wrote: > Thank you very much Boris. > Worked fine. My aim is to read the last sheet and the sheet preceding to it > > What I did is > L = length(getSheets(loadWorkbook("las.xlsx")) > > K1 =read.xlsx("las.xlsx", sheetIndex = L) > K2 =read.xlsx("las.xlsx", sheetIndex = L-1) > > Is it possible to in one step instead of reading the file three times? > > > Val > > > > > > On Sun, Apr 17, 2016 at 9:26 AM, Boris Steipe <boris.ste...@utoronto.ca> > wrote: > Does > length(getSheets(loadWorkbook("las.xlsx")) > > give you the index you need? (Untested). > > B. > > > On Apr 17, 2016, at 9:43 AM, Val <valkr...@gmail.com> wrote: > > > Hi all, > > > > I am trying to read data from a particular excel sheet. > > > > library(xlsx) > > dat1=read.xlsx("las.xlsx", sheetIndex = 5) > > > > I know that this is sheet is the last one and this number grows over time > > > > When I run my script to read the last sheet then I have to change this > > number every time manually. > > > > Is it possible to read the last sheet of an excel file? > > Thank yo in advance > > Val > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > 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@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.