Hi, I am looking for some R function which will tell me, whether a particular sheet in an Excel file (.xlsx/.xls) exists or not. I just need to get some TRUE/FALSE type of answer. Can somebody give me any pointer if such function exists or not? Thanks and regards,
You could use the XLConnect package to do this. For example, something like this might do the trick ... library(XLConnect) mysheet <- "Sheet4" wb <- loadWorkbook("C:/temp/MyData.xlsx") wbsheets <- getSheets(wb) mysheet %in% wbsheets Jean On Tue, Oct 29, 2013 at 3:26 PM, Ron Michael <ron_michael70@yahoo.com>wrote:> Hi, > > I am looking for some R function which will tell me, whether a particular > sheet in an Excel file (.xlsx/.xls) exists or not. I just need to get some > TRUE/FALSE type of answer. > > Can somebody give me any pointer if such function exists or not? > > Thanks and regards, > > ______________________________________________ > 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. >[[alternative HTML version deleted]]
Hi here is the solutions using XLConnect package: library(XLConnect) wb <- loadWorkbook(path to your Excel file) c("particular sheet name")%in%getSheets(wb) Andrija On Tue, Oct 29, 2013 at 9:26 PM, Ron Michael <ron_michael70@yahoo.com>wrote:> Hi, > > I am looking for some R function which will tell me, whether a particular > sheet in an Excel file (.xlsx/.xls) exists or not. I just need to get some > TRUE/FALSE type of answer. > > Can somebody give me any pointer if such function exists or not? > > Thanks and regards, > > ______________________________________________ > 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. >[[alternative HTML version deleted]]