This function is a wrapper for openxlsx2::wb_add_worksheet() and openxlsx2::wb_add_data(), but also does some extra formatting via more {openxlsx2} functions. Note that {openxlsx2} workbooks are modified in place, so wb is updated whether or not the result is assigned.
add_sheet(
wb,
data,
sheet_name = NULL,
col_width = "auto",
col_width_min = 5,
col_width_max = 25,
grid_lines = FALSE,
freeze_first_row = TRUE,
freeze_first_col = FALSE,
add_filters = TRUE,
row_height = 15,
text_wrap = TRUE,
date_format = "yyyy-mm-dd",
datetime_format = "yyyy-mm-dd hh:mm:ss",
na = NULL,
sheetName = deprecated(),
colWidth = deprecated(),
colWidthMin = deprecated(),
colWidthMax = deprecated(),
gridLines = deprecated(),
freezefirstRow = deprecated(),
freezefirstCol = deprecated(),
addFilters = deprecated(),
rowheight = deprecated(),
textwrap = deprecated(),
dateformat = deprecated(),
datetimeformat = deprecated()
)A Workbook object to attach the new worksheet
Object to be written. For classes supported look at the examples in {openxlsx2}.
The name of the worksheet that is to be created and have data written into. Defaults to the data object name if left empty. Must not be the name of an existing sheet (case-insensitive); illegal characters are removed and names are shortened to 31 characters by {openxlsx2} (with a warning).
For all columns: column width. Can either be a spreadsheet column width or "auto" for automatic sizing
For all columns: minimum column width
For all columns: maximum column width
If FALSE, the worksheet grid lines will be hidden
If TRUE, freezes the first row
If TRUE, freezes the first column
If TRUE, adds filters to worksheet columns
Row height in spreadsheet row height units
If TRUE, all cells are formatted via text wrap so their content never spills into adjacent empty cells
If not "none" (default is "yyyy-mm-dd"), all date-formatted columns in data are explicitly formatted with numfmt = "yyyy-mm-dd"
If not "none" (default is "yyyy-mm-dd hh:mm:ss"), all datetime-formatted columns in data are explicitly formatted with numfmt = "yyyy-mm-dd hh:mm:ss"
Value used for replacing NA values from data. The default NULL leaves those cells empty.
The Workbook object, invisibly