# NamedRangeCollection Class

> NamedRangeCollection class in the TX Sheet Control TypeScript API for Node.js: Case-insensitive names scoped to a workbook or one worksheet.

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

---

Case-insensitive names scoped to a workbook or one worksheet. Sheets take precedence over workbook names.

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

Related workbook object-model type, returned through the server control. Obtain it from its owning workbook or collection; it is not a required browser-package import.

### Constructor

```typescript
new NamedRangeCollection(workbook: Workbook, sheetId?: string): NamedRangeCollection
```

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `workbook` | `Workbook` | No | Value matching workbook's declared type and the owning object's validation rules. |
| `sheetId` | `string \| undefined` | Yes | Value matching sheetId's declared type and the owning object's validation rules. |

Returns: `NamedRangeCollection`.

### Members

#### Methods

| Method | Description |
|---|---|
| [find](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/namedrangecollection/find-method/llms-full.txt) | Resolves a name in this scope, or returns undefined. |
| [get](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/namedrangecollection/get-method/llms-full.txt) | Reads a definition; throws RangeError for an unknown name. |
| [list](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/namedrangecollection/list-method/llms-full.txt) | Returns detached definitions from this collection's scope. |
| [remove](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/namedrangecollection/remove-method/llms-full.txt) | Removes a definition in this scope. Formulas subsequently report #NAME? rather than stale values. |
| [set](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/namedrangecollection/set-method/llms-full.txt) | Creates or replaces a definition without expanding a rectangular worksheet. |

### Examples

Use a fresh workbook. Create and format the sample data, apply this API and retain the returned document or result in your application. In the browser pass editor.workbook; in Node.js pass the server control.

```typescript
import type { ServerSheetControl } from '@txtextcontrol/tx-sheet-control-server';

function createNamedRangeCollectionReport(control: ServerSheetControl) {
    const book = control.workbook;
    const sheet = book.sheets.at(0);
    sheet.cell('A1').setText('October invoice');
    sheet
        .cell('A1')
        .format({
            fontFamily: 'Liberation Sans',
            fontSize: 16,
            bold: true,
            textColor: '#ffffff',
            fillColor: '#163b63',
        });

    sheet.columns.at(0).setWidth({ pixels: 240 });
    sheet.range('B8:B9').setValues([[120], [80]]);
    sheet.cell('B10').setFormula('=SUM(B8:B9)');
    sheet.range('B8:B10').format({ numberFormatCode: '#,##0.00', fontSize: 11 });
    book.names.set('InvoiceTotal', "='" + sheet.name.replace(/'/g, "''") + "'!$B$10");
    sheet.cell('D10').setFormula('=InvoiceTotal');
    return sheet;
}
```

### See Also

- [TypeScript Node.js Server API](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/llms-full.txt)
- [Workbooks and Worksheets](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/workbooks/llms-full.txt)

---

## In This Section

- [NamedRangeCollection.find Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/namedrangecollection/find-method/llms-full.txt): NamedRangeCollection.find method in the TX Sheet Control TypeScript API for Node.js: Resolves a name in this scope, or returns undefined.
- [NamedRangeCollection.get Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/namedrangecollection/get-method/llms-full.txt): NamedRangeCollection.get method in the TX Sheet Control TypeScript API for Node.js: Reads a definition; throws RangeError for an unknown name.
- [NamedRangeCollection.list Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/namedrangecollection/list-method/llms-full.txt): NamedRangeCollection.list method in the TX Sheet Control TypeScript API for Node.js: Returns detached definitions from this collection's scope.
- [NamedRangeCollection.remove Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/namedrangecollection/remove-method/llms-full.txt): NamedRangeCollection.remove method in the Node.js TypeScript API: Removes a definition in this scope. Includes the syntax and a TypeScript example.
- [NamedRangeCollection.set Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/namedrangecollection/set-method/llms-full.txt): NamedRangeCollection.set method in the TX Sheet Control TypeScript API for Node.js: Creates or replaces a definition without expanding a rectangular worksheet.

---

## Nearby

- **Previous:** [NamedCellStyle.name Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/namedcellstyle/name-property/llms-full.txt)
- **Next:** [NamedRangeCollection.find Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/namedrangecollection/find-method/llms-full.txt)
