Skip to contents

This function wraps `openxlsx::cloneWorksheet` but sets new content in the cloned sheet.

Usage

xlsxCloneAndSet(wb, clonedSheet, sheetName, dt)

Arguments

wb

A workbook object created by `openxlsx::loadWorkbook()`.

clonedSheet

A character string specifying the name of the sheet to clone.

sheetName

A character string specifying the name of the new sheet.

dt

A `data.table` with new content.

Value

An invisible NULL value. The function performs an action (clone a sheet)

See also

Other function to read from and write to xlsx: setHeadersToLowerCase(), splitInputs(), xlsxAddDataUsingTemplate(), xlsxAddSheet(), xlsxReadData(), xlsxWriteData()

Examples

if (FALSE) { # \dontrun{
wb <- loadWorkbook("example.xlsx")
data <- data.table(Name = c("Eve", "Frank"), Age = c(22, 35))
xlsxCloneAndSet(wb, "ExistingSheet", "ClonedSheet", data)
} # }