Skip to contents

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.