Learn R Programming

openxlsx (version 4.1.0)

removeWorksheet: Remove a worksheet from a workbook

Description

Remove a worksheet from a Workbook object

Remove a worksheet from a workbook

Usage

removeWorksheet(wb, sheet)

Arguments

wb

A workbook object

sheet

A name or index of a worksheet

Examples

Run this code
# NOT RUN {
## load a workbook 
wb <- loadWorkbook(file = system.file("loadExample.xlsx", package = "openxlsx"))

## Remove sheet 2
removeWorksheet(wb, 2)

## save the modified workbook
saveWorkbook(wb, "removeWorksheetExample.xlsx", overwrite = TRUE)
# }

Run the code above in your browser using DataLab