renameWorksheet: Rename a worksheet

Description Usage Arguments Details Author(s) Examples

View source: R/wrappers.R

Description

Rename a worksheet

Usage

1
renameWorksheet(wb, sheet, newName)

Arguments

wb

A Workbook object containing a worksheet

sheet

The name or index of the worksheet to rename

newName

The new name of the worksheet. No longer than 31 chars.

Details

DEPRECATED. Use names

Author(s)

Alexander Walker

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Create a new workbook
wb <- createWorkbook("CREATOR")

## Add 3 worksheets
addWorksheet(wb, "Worksheet Name")
addWorksheet(wb, "This is worksheet 2")
addWorksheet(wb, "Not the best name")

#' ## rename all worksheets
names(wb) <- c("A", "B", "C")


## Rename worksheet 1 & 3
renameWorksheet(wb, 1, "New name for sheet 1")
names(wb)[[1]] <- "New name for sheet 1"
names(wb)[[3]] <- "A better name"

## Save workbook
## Not run: 
saveWorkbook(wb, "renameWorksheetExample.xlsx", overwrite = TRUE)

## End(Not run)

openxlsx documentation built on June 16, 2021, 9:06 a.m.