buildWorkbook {openxlsx}R Documentation

Build Workbook

Description

Build a workbook from a data.frame or named list

Usage

buildWorkbook(x, asTable = FALSE, ...)

Arguments

x

A data.frame or a (named) list of objects that can be handled by writeData() or writeDataTable() to write to file

asTable

If TRUE will use writeDataTable() rather than writeData() to write x to the file (default: FALSE)

...

Additional arguments passed to writeData(), writeDataTable(), setColWidths() (see Optional Parameters)

Details

This function can be used as shortcut to create a workbook object from a data.frame or named list. If names are available in the list they will be used as the worksheet names. The parameters in ... are collected and passed to writeData() or writeDataTable() to initially create the Workbook objects then appropriate parameters are passed to setColWidths().

columns of x with class Date or POSIXt are automatically styled as dates and datetimes respectively.

Value

A Workbook object

Optional Parameters

createWorkbook Parameters

addWorksheet Parameters

writeData/writeDataTable Parameters

freezePane Parameters

colWidths Parameters

Author(s)

Jordan Mark Barbone

See Also

write.xlsx()

Examples

x <- data.frame(a = 1, b = 2)
wb <- buildWorkbook(x)

y <- list(a = x, b = x, c = x)
buildWorkbook(y, asTable = TRUE)
buildWorkbook(y, asTable = TRUE, tableStyle = "TableStyleLight8")


[Package openxlsx version 4.2.5 Index]