Add data to a worksheet and format as an Excel table
wb_add_data_table(
wb,
sheet = current_sheet(),
x,
startCol = 1,
startRow = 1,
dims = rowcol_to_dims(startRow, startCol),
xy = NULL,
colNames = TRUE,
rowNames = FALSE,
tableStyle = "TableStyleLight9",
tableName = NULL,
withFilter = TRUE,
sep = ", ",
firstColumn = FALSE,
lastColumn = FALSE,
bandedRows = TRUE,
bandedCols = FALSE,
applyCellStyle = TRUE,
removeCellStyle = FALSE,
na.strings
)
A Workbook object containing a #' worksheet.
The worksheet to write to. Can be the worksheet index or name.
A dataframe.
A vector specifying the starting column to write df
A vector specifying the starting row to write df
Spreadsheet dimensions that will determine startCol and startRow: "A1", "A1:B2", "A:B"
An alternative to specifying startCol and startRow individually. A vector of the form c(startCol, startRow)
If TRUE
, column names of x are written.
If TRUE
, row names of x are written.
Any excel table style name or "none" (see "formatting" vignette).
name of table in workbook. The table name must be unique.
If TRUE
, columns with have filters in the first row.
Only applies to list columns. The separator used to collapse list
columns to a character vector e.g. sapply(x$list_column, paste, collapse =
sep).
The below options correspond to Excel table options:
logical. If TRUE, the first column is bold
logical. If TRUE, the last column is bold
logical. If TRUE, rows are colour banded
logical. If TRUE, the columns are colour banded
Should we write cell styles to the workbook
keep the cell style?
optional
columns of x with class Date/POSIXt, currency, accounting,
hyperlink, percentage are automatically styled as dates, currency,
accounting, hyperlinks, percentages respectively. The string "_openxlsx_NA"
is reserved for openxlsx2
. If the data frame contains this string, the
output will be broken.
Other workbook wrappers:
wb_add_chartsheet()
,
wb_add_data()
,
wb_add_formula()
,
wb_add_worksheet()
,
wb_clone_worksheet()
,
wb_creators
,
wb_freeze_pane()
,
wb_get_base_font()
,
wb_save()
,
wb_set_col_widths()
,
wb_set_last_modified_by()
,
wb_set_row_heights()
,
wb_workbook()
,
workbook_grouping
,
ws_cell_merge