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),
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 = na_strings(),
inline_strings = TRUE
)
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"
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 color banded
logical. If TRUE, the columns are color banded
Should we write cell styles to the workbook
keep the cell style?
Value used for replacing NA
values from x
. Default
na_strings()
uses the special #N/A
value within the workbook.
write characters as inline strings
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_pivot_table()
,
wb_add_worksheet()
,
wb_clone_worksheet()
,
wb_copy_cells()
,
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