excel.link (version 0.9.9)

xl.sheet.add: Basic operations with worksheets.

Description

Basic operations with worksheets.

Usage

xl.sheet.add(xl.sheet.name = NULL, before = NULL)

xl.sheet.duplicate(before = NULL)

xl.sheet.name(xl.sheet.name = NULL)

xl.sheet.visible(xl.sheet)

xl.sheet.hide(xl.sheet = NULL)

xl.sheet.show(xl.sheet)

xl.sheets()

xl.sheet.activate(xl.sheet)

xl.sheet.delete(xl.sheet = NULL)

Arguments

xl.sheet.name

character. sheet name/new sheet name

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/xl.sheet.duplicate invisibly return name of created/activated/duplicated 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.name rename active sheet. If its argument is missing then it just return active sheet name.

  • xl.sheet.hide/xl.sheet.show hide and show sheet by its name. xl.sheet.visible returns current visibility status of the sheet.

  • 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 {
# }
# 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 
xl.sheet.duplicate() # duplicate second sheet
xl.sheet.name() # "Second (2)"
xl.sheet.name("Third") # "Third"

# }

Run the code above in your browser using DataLab