R: Build Workbook

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`

### 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`.

### Value

A Workbook object

### 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.4 Index]