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>;| Parameter | Type | Required |
|---|---|---|
| cell | string | required |
| dataRange | string | CellRange | required |
| type | SparklineType | required |
| options | CreateSparklineOptions | optional |
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>;| Parameter | Type | Required |
|---|---|---|
| cells | Array<{ row: number; col: number }> | required |
| dataRanges | CellRange[] | required |
| type | SparklineType | required |
| options | CreateSparklineGroupOptions | optional |
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>;| Parameter | Type | Required |
|---|---|---|
| sparklineId | string | required |
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>;| Parameter | Type | Required |
|---|---|---|
| address | string | required |
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>;| Parameter | Type | Required |
|---|---|---|
| groupId | string | required |
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>;| Parameter | Type | Required |
|---|---|---|
| sparklineId | string | required |
| updates | Partial<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>;| Parameter | Type | Required |
|---|---|---|
| groupId | string | required |
| updates | Partial<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>;| Parameter | Type | Required |
|---|---|---|
| sparklineId | string | required |
Remove a sparkline. @param sparklineId - Sparkline identifier
removeGroup
→ Promise<void>removeGroup(groupId: string): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| groupId | string | required |
Remove a sparkline group and all its member sparklines. @param groupId - Group identifier
clearInRange
→ Promise<void>clearInRange(range: string | CellRange): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| range | string | CellRange | required |
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>;| Parameter | Type | Required |
|---|---|---|
| sparklineId | string | required |
| groupId | string | required |
Add a sparkline to a group. @param sparklineId - Sparkline identifier @param groupId - Group identifier
removeFromGroup
→ Promise<void>removeFromGroup(sparklineId: string): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| sparklineId | string | required |
Remove a sparkline from its group (becomes standalone). @param sparklineId - Sparkline identifier
ungroupAll
→ Promise<string[]>ungroupAll(groupId: string): Promise<string[]>;| Parameter | Type | Required |
|---|---|---|
| groupId | string | required |
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>;| Parameter | Type | Required |
|---|---|---|
| address | string | required |
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[]>;| Parameter | Type | Required |
|---|---|---|
| range | string | CellRange | required |
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