# Cell.setBarcode Method

> Cell.setBarcode method in the Node.js JavaScript API: Displays a barcode while keeping the cell's value or formula; omit options to remove only the barcode.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Method
- **Path:** TX Sheet Control > API Reference > JavaScript API > Node.js Server > Cell > Cell.setBarcode Method
- **303 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/cell/setbarcode-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/cell/setbarcode-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/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-server`.

### Syntax

```javascript
owner.setBarcode(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;
const sheet = book.sheets.at(0);
sheet.cell('A2').setText('000123');
sheet.cell('A2').setBarcode({ symbology: 'code128' });
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:** [Cell.barcode Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/cell/barcode-property/llms-full.txt)
- **Next:** [CellComments Class](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/cellcomments/llms-full.txt)
