wb_new_workbook() is a convenience function wrapping
openxlsx2::wb_workbook() and openxlsx2::wb_add_worksheet() to offer quick
and easy setup for new workbooks.
Usage
wb_new_workbook(
sheet_names = NULL,
...,
default = "Sheet",
creator = NULL,
title = NULL,
subject = NULL,
category = NULL,
datetime_created = Sys.time(),
theme = NULL,
keywords = NULL,
properties = NULL,
call = caller_env()
)Arguments
- sheet_names
Optional character vector of worksheet names.
- ...
Arguments passed on to
openxlsx2::wb_add_worksheetgrid_linesLogical; if
FALSE, the worksheet grid lines are hidden.row_col_headersLogical; if
FALSE, row numbers and column letters are hidden.tab_colorThe color of the worksheet tab. Accepts a
wb_color()object, a standard R color name, or a hex color code (e.g., "#4F81BD").zoomThe sheet zoom level as a percentage; a numeric value between 10 and 400. Values below 10 default to 10.
header,footerDefault character vectors of length three for the left, center, and right sections of the header or footer.
odd_header,odd_footerSpecific definitions for odd-numbered pages. Defaults to the values provided in
headerandfooter.even_header,even_footerSpecific definitions for even-numbered pages. Defaults to the values provided in
headerandfooter.first_header,first_footerSpecific definitions for the first page of the worksheet. Defaults to the values provided in
headerandfooter.visibleThe visibility state of the sheet. One of "visible", "hidden", or "veryHidden".
has_drawingdefunct
paper_sizeAn integer code representing a standard paper size. Refer to
wb_page_setup()for a complete list of codes.orientationThe page orientation, either "portrait" or "landscape".
hdpi,vdpiThe horizontal and vertical DPI (dots per inch) for printing and rendering. Can be set globally via
options("openxlsx2.hdpi").
- default
Default prefix to use for numbered sheets. Default values are used if
sheet_names = NULLor ifn_sheetsis greater than the length ofsheet_names. Defaults to "Sheet".- creator
Creator of the workbook (your name). Defaults to login username or
options("openxlsx2.creator")if set.- title, subject, category, keywords
Additional arguments passed to
openxlsx2::wb_workbook().- datetime_created
The time of the workbook is created
- theme
Optional theme identified by string or number. See Details for options.
- properties
A named list (typically from
openxlsx2::wb_get_properties()) used to set new workbook properties for any values set toNULL.datetime_createddefaults toSys.time()so must be set toNULLto inherit value fromproperties.- call
The execution environment of a currently running function, e.g.
caller_env(). The function will be mentioned in error messages as the source of the error. See thecallargument ofabort()for more information.
Examples
wb_new_workbook()
#> A Workbook object.
#>
#> Worksheets:
#> No worksheets attached
#>
wb_new_workbook("Sheet 1")
#> A Workbook object.
#>
#> Worksheets:
#> Sheets: Sheet 1
#> Write order: 1
wb_new_workbook(c("Data", "Analysis"))
#> A Workbook object.
#>
#> Worksheets:
#> Sheets: Data, Analysis
#> Write order: 1, 2