# Cell.setBarcode Method

> Cell.setBarcode method in the TX Sheet Control JavaScript API for the browser, with its syntax and a JavaScript example.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Method
- **Path:** TX Sheet Control > API Reference > JavaScript API > Browser Editor > Cell > Cell.setBarcode Method
- **279 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/cell/setbarcode-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/cell/setbarcode-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/cell/setbarcode-method/llms-full.txt

---

Displays a barcode while retaining the underlying value or formula. Omit options to remove only the barcode.

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

### Syntax

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

### Examples

Use an existing workbook as `book`.

```javascript
import { Workbook as ExampleWorkbook } from '@txtextcontrol/tx-sheet-control';
const book = new ExampleWorkbook();
const sheet = book.sheets.at(0);
sheet.cell('A2').setText('000123');
sheet.cell('A2').setBarcode({ symbology: 'code128' });
```

### 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:** [Cell.barcode Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/cell/barcode-property/llms-full.txt)
- **Next:** [CellComments Class](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/cellcomments/llms-full.txt)
