xlsimple (version 1.0.5)

addXLsheetStd: Add a sheet to the 'Excel' workbook

Description

Add a sheet to the 'Excel' workbook

Usage

addXLsheetStd(wbList = XL.wb, df = NA, sheetName = NA, descrip = NA)

Arguments

wbList

list with workbook and default cell styles (i.e., output from getXLsettings)

df

data frame to output to sheet

sheetName

sheet name

descrip

description of sheet

Value

list with workbook and default cell styles

Details

The sheetName is the name that will be used for the sheet. When sheetName is not specified, the name of the df will be used. The descrip is a character string that will be placed into cell A1 of the sheet and is best used to provide a brief description of the sheet; and the dataframe will begin at cell A3. If descrip is not specified, then the dataframe will begin at cell A1. The outputted table will have filters turned on and table headers and first column frozen.

Examples

Run this code
# NOT RUN {
XL.wb <- getXLsettings()
XL.wb <- addXLsheetStd(XL.wb, mtcars)
XL.wb <- addXLsheetStd(XL.wb, mtcars, "mtcars1")
XL.wb <- addXLsheetStd(XL.wb, mtcars, "mtcars2", "Standard mtcars data frame")
XL.wb$pName <- "ProjName" # optional, blank if not included
XL.wb$pDesc <- "ProjDesc" # optional, blank if not included
saveXLworkbook(XL.wb, file.path(tempdir(), 'myXLfile.xlsx'), timeStamp=FALSE, clean=FALSE)
saveXLworkbook(XL.wb, file.path(tempdir(), 'myXLfile.xlsx'), timeStamp=TRUE,  clean=FALSE)
saveXLworkbook(XL.wb, file.path(tempdir(), 'myXLfile.xlsx'), timeStamp=TRUE,  clean=TRUE)
saveXLworkbook(XL.wb, file.path(tempdir(), 'myXLfile.xlsx'))

# }

Run the code above in your browser using DataCamp Workspace