# Worksheet.addSparklines Method

> Worksheet.addSparklines method in the Node.js JavaScript API: Adds sparklines using A1 data/location ranges in one undoable sheet-scoped transaction.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Method
- **Path:** TX Sheet Control > API Reference > JavaScript API > Node.js Server > Worksheet > Worksheet.addSparklines Method
- **438 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/worksheet/addsparklines-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/worksheet/addsparklines-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/worksheet/addsparklines-method/llms-full.txt

---

Adds sparklines using A1 data/location ranges in one undoable sheet-scoped transaction.

Owner: [Worksheet](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/worksheet/llms-full.txt). Package: `@txtextcontrol/tx-sheet-control-server`. Version: **2.0.0**.

### Syntax

```javascript
owner.addSparklines(options)
```

### Parameters

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `options` | `SparklineOptions` | No | Supported settings for this operation; omitted settings retain documented defaults. |

### Return Value

`string`.

### Examples

Use a fresh sample workbook for this example. In the browser pass editor.workbook; in Node.js pass the server control. Document-bound objects are obtained from that same owner.

```javascript
function applyWorksheetAddSparklines(control) {
    const book = control.workbook;
    const worksheet = book.sheets.at(0);
    const result = worksheet.addSparklines({ dataRange: 'B2:D2', locationRange: 'E2', type: 'line' });
    return result;
}
```

### Remarks

Use this member on an object from the current document. Reacquire document-bound handles after replacement/deletion. Validate arguments against the declared types and documented bounds; handle exceptions or rejected promises.

### See Also

- [Worksheet Class](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/worksheet/llms-full.txt)
- [Charts and Sparklines](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/charts/llms-full.txt)
- [SparklineOptions Interface](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/sparklineoptions/llms-full.txt)

---

## Nearby

- **Previous:** [Worksheet Class](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/worksheet/llms-full.txt)
- **Next:** [Worksheet.cell Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/worksheet/cell-method/llms-full.txt)
