# DrawingCollection.addBarcode Method

> DrawingCollection.addBarcode method in the TX Sheet Control TypeScript API for the browser, with its syntax and a TypeScript example.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Method
- **Path:** TX Sheet Control > API Reference > TypeScript API > Browser Editor > DrawingCollection > DrawingCollection.addBarcode Method
- **267 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/drawingcollection/addbarcode-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/drawingcollection/addbarcode-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/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`.

### Syntax

```typescript
addBarcode(options: BarcodeDrawingOptions): DrawingHandle
```

### Example

Use an existing workbook as `book`.

```typescript
import { Workbook as ExampleWorkbook } from '@txtextcontrol/tx-sheet-control';
const book = new ExampleWorkbook();

book.sheets.at(0).drawings.addBarcode({
    symbology: 'qrCode', source: '=A2', anchor: { cell: 'D2' },
    size: { width: 160, height: 160 }
});
```

### 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/typescript-api/browser/drawingcollection/sheet-property/llms-full.txt)
- **Next:** [DrawingGroup Class](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/drawinggroup/llms-full.txt)
