wb_add_sparklines: Add sparklines to a worksheet

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

wb_add_sparklinesR Documentation

Add sparklines to a worksheet

Description

wb_add_sparklines() takes the XML definitions created by create_sparklines() and embeds them into the specified worksheet of a wbWorkbook.

Usage

wb_add_sparklines(wb, sheet = current_sheet(), sparklines)

Arguments

wb

A wbWorkbook object.

sheet

The name or index of the worksheet where the sparklines will be rendered. Defaults to the current sheet.

sparklines

A character vector of sparkline XML strings generated by create_sparklines().

See Also

create_sparklines()

Examples

 sl <- create_sparklines("Sheet 1", dims = "A3:K3", sqref = "L3")
 wb <- wb_workbook()
 wb <- wb_add_worksheet(wb)
 wb <- wb_add_data(wb, x = mtcars)
 wb <- wb_add_sparklines(wb, sparklines = sl)

openxlsx2 documentation built on Feb. 21, 2026, 9:07 a.m.