# DrawingCollection.addBarcode Method

> DrawingCollection.addBarcode method in the TX Sheet Control JavaScript API for Node.js, with its syntax and a JavaScript example.

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

---

Inserts a movable barcode or QR code. Missing source/value reads its anchor cell.

Package: `@txtextcontrol/tx-sheet-control-server`.

### Syntax

```javascript
owner.addBarcode(options);
```

### Examples

Use an existing workbook as `book`.

```javascript
import { ServerSheetControl as ExampleServer } from '@txtextcontrol/tx-sheet-control-server';
const exampleControl = new ExampleServer();
const book = exampleControl.workbook;
book.sheets.at(0).drawings.addBarcode({
    symbology: 'qrCode', source: '=A2', anchor: { cell: 'D2' },
    size: { width: 160, height: 160 }
});
exampleControl.destroy();
```

### Remarks

Settings are detached snapshots. Cell values and formulas remain available beneath the symbol. Sources resolve after calculation and mail merge. See [Barcodes and QR Codes](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/barcodes/llms-full.txt) for validation, supported payloads and XLSX behavior.

---

## Nearby

- **Previous:** [DrawingCollection.sheet Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/drawingcollection/sheet-property/llms-full.txt)
- **Next:** [DrawingGroup Class](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/drawinggroup/llms-full.txt)
