Learn R Programming

excel.link (version 0.9.4)

xl.sheet.add: Basic operations with worksheets.

Description

Basic operations with worksheets.

Usage

xl.sheet.add(xl.sheet.name = NULL, before = NULL)
xl.sheets()
xl.sheet.activate(xl.sheet)
xl.sheet.delete(xl.sheet = NULL)

Arguments

xl.sheet.name
character. sheet name in active workbook
before
character/numeric. sheet name or sheet number in active workbook before which new sheet will be added
xl.sheet
character/numeric. sheet name or sheet number in active workbook

Value

  • xl.sheet.add/xl.sheet.activate invisibly return name of created/activated sheet.
  • xl.sheets returns vector of sheet names in active workbook.
  • xl.sheet.delete invisibly returns NULL.

Details

  • xl.sheet.add adds new sheet with given name and invisibly returns name of this newly added sheet. Added sheet become active. If xl.sheet.name is missing default name will be used. If before argument is missing, sheet will be added at the last position. If sheet with given name already exists error will be generated.
  • xl.sheet.activate activates sheet with given name/number. If sheet with this name doesn't exist error will be generated.
  • xl.sheet.delete deletes sheet with given name/number. If name doesn't submitted it delete active sheet.

See Also

xl.workbooks

Examples

Run this code

## Not run:  
# xl.workbook.add()
# sheets = xl.sheets()
# xl.sheet.add("Second")
# xl.sheet.add("First", before="Second")
# for (sheet in sheets) xl.sheet.delete(sheet) # only 'First' and 'Second' exist in workbook now
# xl.sheet.activate("Second") #last sheet activated 
# 
# ## End(Not run)

Run the code above in your browser using DataLab