Optional parameters are:
createWorkbook Parameters
• creator A string specifying the workbook author
addWorksheet Parameters
• sheetName Name of the worksheet
• gridLines A logical. If FALSE, the worksheet grid lines will be hidden.
• tabColour Colour of the worksheet tab. A valid colour (belonging to colours()) or a valid hex
colour beginning with "#".
• zoom A numeric between 10 and 400. Worksheet zoom level as a percentage.
writeData/writeDataTable Parameters
• startCol A vector specifying the starting column(s) to write df
• startRow A vector specifying the starting row(s) to write df
• xy An alternative to specifying startCol and startRow individually. A vector of the form
c(startCol, startRow)
• colNames or col.names If TRUE, column names of x are written.
• rowNames or row.names If TRUE, row names of x are written.
• headerStyle Custom style to apply to column names.
• borders Either "surrounding", "columns" or "rows" or NULL. If "surrounding", a border is
drawn around the data. If "rows", a surrounding border is drawn a border around each row.
If "columns", a surrounding border is drawn with a border between each column. If "all" all
cell borders are drawn.
• borderColour Colour of cell border
• borderStyle Border line style.
• keepNA If TRUE, NA values are converted to #N/A in Excel else NA cells will be empty.
Defaults to FALSE.
writeData Write an object to a worksheet
Description
Write an object to worksheet with optional styling.
Usage
writeData(wb, sheet, x, startCol = 1, startRow = 1, xy = NULL,
colNames = TRUE, rowNames = FALSE, headerStyle = NULL,
borders = c("none", "surrounding", "rows", "columns", "all"),
borderColour = getOption("openxlsx.borderColour", "black"),
borderStyle = getOption("openxlsx.borderStyle", "thin"),
withFilter = FALSE, keepNA = FALSE, name = NULL, sep = ", ")
Arguments
wb A Workbook object containing a worksheet.
sheet The worksheet to write to. Can be the worksheet index or name.
x Object to be written. For classes supported look at the examples.
startCol A vector specifying the starting column to write to.
startRow A vector specifying the starting row to write to.
xy An alternative to specifying startCol and startRow individually. A vector of
the form c(startCol, startRow).
colNames If TRUE, column names of x are written.
rowNames If TRUE, data.frame row names of x are written.
headerStyle Custom style to apply to column names.
borders Either "none" (default), "surrounding", "columns", "rows" or respective abbreviations.
If "surrounding", a border is drawn around the data. If "rows",
a surrounding border is drawn with a border around each row. If "columns", a
surrounding border is drawn with a border between each column. If "all" all
cell borders are drawn.
borderColour Colour of cell border. A valid colour (belonging to colours() or a hex colour
code, eg see here).
borderStyle Border line style
• none no border
• thin thin border
• medium medium border
• dashed dashed border
• dotted dotted border
• thick thick border