# encodeBarcode Function

> encodeBarcode function in the Node.js TypeScript API: Encodes a standalone payload into detached module rows. It does not resolve workbook source references.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Function
- **Path:** TX Sheet Control > API Reference > TypeScript API > Node.js Server > encodeBarcode Function
- **250 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/encodebarcode-function/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/encodebarcode-function/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/encodebarcode-function/llms-full.txt

---

Encodes a standalone payload into detached module rows. It does not resolve workbook source references.

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

### Syntax

```typescript
encodeBarcode(options: BarcodeOptions, value?: string): BarcodeSymbol
```

### Example

Use an existing workbook as `book`.

```typescript
import { encodeBarcode } from '@txtextcontrol/tx-sheet-control-server';
const result = encodeBarcode({ symbology: 'code128' }, 'ORDER-0001');
```

### Remarks

Standalone helpers do not read workbook cells. The value argument supplies the payload; when omitted, the encoder uses options.value or an empty string. Use cell or drawing barcode settings for live source bindings. EAN and UPC check digits are generated or validated. Invalid settings or nonempty payloads throw an error.

See [Barcodes and QR Codes](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/barcodes/llms-full.txt) for supported payloads, quiet zones and examples.

---

## Nearby

- **Previous:** [BarcodeSymbology Type](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/barcodesymbology/llms-full.txt)
- **Next:** [renderBarcodeSVG Function](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/renderbarcodesvg-function/llms-full.txt)
