I am using the XLConnect
package in R to read in .xlsx workbooks based on tab name. There are two variations in tab name I would like to read in ("All Sales" OR "Tot Sales"). I need to select either term because some months are named inconsistently.
# Set Workbook
xls <- loadWorkbook("mydoc.xlsx"))
# Read in Worksheet
wks <- readWorksheet(xls,sheet = grep("All Sales|Tot Sales"))
This yields the following error:
Error in grep("All Sales|Tot Sales") :
argument "x" is missing, with no default
How do I return either name?
You didn't pass the required x (where to search for the pattern) argument.
# Set Workbook
xls <- loadWorkbook("mydoc.xlsx")
# Read in Worksheet
wks <- readWorksheet(xls,sheet = grep("All Sales|Tot Sales", getSheets(xls)))