Learn R Programming

gdata (version 2.19.0)

sheetCount: Count or list sheet names in Excel spreadsheet files.

Description

Count or list sheet names in Excel spreadsheet files.

Usage

sheetCount(xls, verbose = FALSE, perl = "perl")
sheetNames(xls, verbose = FALSE, perl = "perl")

Value

sheetCount returns the number of sheets in the spreadsheet.

sheetNames returns the names of sheets in the spreadsheet.

Arguments

xls

File path to spreadsheet. Supports "http://", "https://", and "ftp://" URLS.

verbose

If TRUE, show additional messages during processing.

perl

Path to perl interpreter.

Warning

Excel file support is deprecated in gdata version 2.19.0, to be removed in the near future. At the user level, the functions installXLSXsupport, read.xls, sheetCount, sheetNames, xls2csv, xls2sep, xls2tab, xls2tsv, and xlsFormats now raise a warning about the functionality being deprecated.

Excel file support was first introduced in gregmisc/gdata 1.11.0 back in 2004, but today we have packages such as openxlsx, readxl, XLConnect, and xlsx offering dedicated Excel file support with more features. When Excel file support will be removed from the gdata package, it will result in lighter package maintenance and no more Perl warnings on the user side.

See Also

read.xls, xls2csv.

Examples

Run this code
   if (FALSE) {
   xlsfile <- system.file("xls", "iris.xls", package = "gdata")
   xlsfile

   sheetCount(xlsfile)
   sheetNames(xlsfile) # no names, so numbers returned

   exampleFile <- system.file('xls', 'ExampleExcelFile.xls', package="gdata")
   sheetCount(exampleFile)
   sheetNames(exampleFile)

   if( 'XLSX' %in% xlsFormats() )  # if XLSX is supported..
   {
     exampleFile2007 <- system.file('xls','ExampleExcelFile.xlsx', package="gdata")
     print( sheetCount(exampleFile2007) )
     print( sheetNames(exampleFile2007) )
   }
   }

Run the code above in your browser using DataLab