Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List xlsx sheetnames with R

Tags:

r

xlsx

Is it possible to generate a list of sheetnames within an xlsx file? Or perhaps, can I check if a sheet name exists, and if not, proceed with some designated function?

like image 227
user1664455 Avatar asked Sep 12 '12 02:09

user1664455


People also ask

How do I get an xlsx package in R?

To install a package in R environment, we can execute the below command on the console of R: > install. packages("xlsx")

What package is write xlsx in R?

xlsx package is one of the powerful R packages to read, write and format Excel files. It is a java-based solution and it is available for Windows, Mac and Linux. It works for both Excel 2007 and Excel 97/2000/XP/2003 file formats (xls and xlsx file formats).

How do I read multiple tabs in Excel in R?

For importing multiple Excel sheets into R, we have to, first install a package in R which is known as readxl. After successfully installing the package, we have to load the package using the library function is R.


1 Answers

With xlsx library you can get the list of the sheets in an existing workbook with getSheets():

wb <- loadWorkbook(your_xlsx_file)
sheets <- getSheets(wb) 
like image 111
Geza Avatar answered Sep 20 '22 18:09

Geza