Skip to content

ws.sparklines

WorksheetSparklines

Sub-API for sparkline operations on a worksheet.

20 methods

add

Promise<Sparkline>
add(
    cell: string,
    dataRange: string | CellRange,
    type: SparklineType,
    options?: CreateSparklineOptions,
  ): Promise<Sparkline>;
ParameterTypeRequired
cellstringrequired
dataRangestring | CellRangerequired
typeSparklineTyperequired
optionsCreateSparklineOptionsoptional

Add a sparkline to a cell (A1 address form). @param cell - A1-style cell address (e.g. "B1") @param dataRange - Data range (A1-style string or CellRange) @param type - Sparkline type (line, column, winLoss) @param options - Optional creation settings @returns The created sparkline

addGroup

Promise<SparklineGroup>
addGroup(
    cells: Array<{ row: number; col: number }>,
    dataRanges: CellRange[],
    type: SparklineType,
    options?: CreateSparklineGroupOptions,
  ): Promise<SparklineGroup>;
ParameterTypeRequired
cellsArray<{ row: number; col: number }>required
dataRangesCellRange[]required
typeSparklineTyperequired
optionsCreateSparklineGroupOptionsoptional

Add a group of sparklines with shared settings. @param cells - Array of cell positions @param dataRanges - Array of data ranges (must match cells length) @param type - Sparkline type @param options - Optional group creation settings @returns The created sparkline group

get

Promise<Sparkline | null>
get(sparklineId: string): Promise<Sparkline | null>;
ParameterTypeRequired
sparklineIdstringrequired

Get a sparkline by ID. @param sparklineId - Sparkline identifier @returns The sparkline, or null if not found

getAtCell

Promise<Sparkline | null>
getAtCell(address: string): Promise<Sparkline | null>;
ParameterTypeRequired
addressstringrequired

Get the sparkline at a specific cell. @param address - A1-style cell address (e.g. "B1") @returns The sparkline at the cell, or null if none

list

Promise<Sparkline[]>
list(): Promise<Sparkline[]>;

List all sparklines in the worksheet. @returns Array of all sparklines

getGroup

Promise<SparklineGroup | null>
getGroup(groupId: string): Promise<SparklineGroup | null>;
ParameterTypeRequired
groupIdstringrequired

Get a sparkline group by ID. @param groupId - Group identifier @returns The sparkline group, or null if not found

listGroups

Promise<SparklineGroup[]>
listGroups(): Promise<SparklineGroup[]>;

List all sparkline groups in the worksheet. @returns Array of all sparkline groups

update

Promise<void>
update(sparklineId: string, updates: Partial<Sparkline>): Promise<void>;
ParameterTypeRequired
sparklineIdstringrequired
updatesPartial<Sparkline>required

Update a sparkline's settings. @param sparklineId - Sparkline identifier @param updates - Partial sparkline properties to update

updateGroup

Promise<void>
updateGroup(groupId: string, updates: Partial<SparklineGroup>): Promise<void>;
ParameterTypeRequired
groupIdstringrequired
updatesPartial<SparklineGroup>required

Update a sparkline group's settings (applies to all members). @param groupId - Group identifier @param updates - Partial group properties to update

remove

Promise<void>
remove(sparklineId: string): Promise<void>;
ParameterTypeRequired
sparklineIdstringrequired

Remove a sparkline. @param sparklineId - Sparkline identifier

removeGroup

Promise<void>
removeGroup(groupId: string): Promise<void>;
ParameterTypeRequired
groupIdstringrequired

Remove a sparkline group and all its member sparklines. @param groupId - Group identifier

clearInRange

Promise<void>
clearInRange(range: string | CellRange): Promise<void>;
ParameterTypeRequired
rangestring | CellRangerequired

Clear all sparklines whose cell falls within a range. @param range - A1-style range string or CellRange object

clear

Promise<void>
clear(): Promise<void>;

Clear all sparklines in the worksheet.

clearAll

Promise<void>
clearAll(): Promise<void>;

Clear all sparklines in the worksheet. @deprecated Use `clear()` instead.

addToGroup

Promise<void>
addToGroup(sparklineId: string, groupId: string): Promise<void>;
ParameterTypeRequired
sparklineIdstringrequired
groupIdstringrequired

Add a sparkline to a group. @param sparklineId - Sparkline identifier @param groupId - Group identifier

removeFromGroup

Promise<void>
removeFromGroup(sparklineId: string): Promise<void>;
ParameterTypeRequired
sparklineIdstringrequired

Remove a sparkline from its group (becomes standalone). @param sparklineId - Sparkline identifier

ungroupAll

Promise<string[]>
ungroupAll(groupId: string): Promise<string[]>;
ParameterTypeRequired
groupIdstringrequired

Ungroup all sparklines in a group (members become standalone). @param groupId - Group identifier @returns IDs of sparklines that were ungrouped

has

Promise<boolean>
has(address: string): Promise<boolean>;
ParameterTypeRequired
addressstringrequired

Check if a cell has a sparkline. @param address - A1-style cell address (e.g. "B1") @returns True if the cell has a sparkline

getCount

Promise<number>
getCount(): Promise<number>;

Get the total number of sparklines on this sheet. @returns The count of sparklines

getWithDataInRange

Promise<Sparkline[]>
getWithDataInRange(range: string | CellRange): Promise<Sparkline[]>;
ParameterTypeRequired
rangestring | CellRangerequired

Get sparklines whose data range intersects with a given range. @param range - A1-style range string or CellRange object @returns Sparklines with data in the range