wb_add_chartsheet: Add a chartsheet to a workbook

View source: R/class-workbook-wrappers.R

wb_add_chartsheetR Documentation

Add a chartsheet to a workbook

Description

The wb_add_chartsheet() function appends a specialized chartsheet to a wbWorkbook object. Unlike standard worksheets, which contain a grid of cells, a chartsheet is dedicated exclusively to the display of a single, full-page chart.

Usage

wb_add_chartsheet(
  wb,
  sheet = next_sheet(),
  tab_color = NULL,
  zoom = 100,
  visible = c("true", "false", "hidden", "visible", "veryhidden"),
  ...
)

Arguments

wb

A wbWorkbook object to which the new chartsheet will be attached.

sheet

A character string for the chartsheet name. Defaults to a sequentially generated name (e.g., "Sheet 1").

tab_color

The color of the sheet tab. Accepts a wb_color() object, a standard R color name, or a hex color code.

zoom

The zoom level as a percentage; a numeric value between 10 and 400.

visible

The visibility state of the sheet. Options include "visible", "hidden", or "veryHidden".

...

Additional arguments passed to internal configuration methods.

Details

A chartsheet is a distinct sheet type in the OpenXML specification. It does not support standard cell data, grid lines, or typical worksheet features. Its primary purpose is to provide a high-level, focused view of a graphical representation.

Important: A chartsheet must contain a chart object to be valid. Adding a chartsheet without subsequently attaching a chart via wb_add_mschart() will result in a corrupt workbook that may fail to open in spreadsheet software.

Like standard worksheets, chartsheets support visual customization such as tab_color, zoom levels, and various visible states.

See Also

wb_add_mschart(), wb_add_worksheet()

Other workbook wrappers: base_font-wb, col_widths-wb, creators-wb, grouping-wb, row_heights-wb, wb_add_data(), wb_add_data_table(), wb_add_formula(), wb_add_hyperlink(), wb_add_pivot_table(), wb_add_slicer(), wb_add_worksheet(), wb_base_colors, wb_clone_worksheet(), wb_copy_cells(), wb_freeze_pane(), wb_merge_cells(), wb_save(), wb_set_last_modified_by(), wb_workbook()


openxlsx2 documentation built on March 7, 2026, 5:06 p.m.