Skip to contents

Include a data.frame into a workbook applying a tableStyle and an auto width to the column. For better results you could setup options("openxlsx.minWidth" = 6)

Usage

addDataTable(
  wb,
  df,
  sheet,
  tableName,
  tableStyle = "TableStyleMedium1",
  withFilter = TRUE,
  firstActiveCol = NULL,
  ...
)

Arguments

wb

a workbook object

df

a data.frame

sheet

the sheet name. If missing the name of the data.frame

tableName

a name for the table in the excel document. If missing the name of the data.frame

tableStyle

a tableStyle name

withFilter

if TRUE the filter is included

firstActiveCol

First column active on the the freeze panel

...

other parameters for the writeDataTable

Value

silently the wb

Examples

if (FALSE) {
library(openxlxs)
options("openxlsx.minWidth" = 6)
wb <- createWorkbook(title = "Test addDataTable")
addDataTable(wb,iris)
saveWorkbook(wb, "test_addDataTable.xlsx")
}