# SheetCollection Class

> SheetCollection class in the TX Sheet Control JavaScript API for Node.js: Stable sheet lookup and creation without changing the selected worksheet.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Class
- **Path:** TX Sheet Control > API Reference > JavaScript API > Node.js Server > SheetCollection Class
- **940 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/llms-full.txt

---

Stable sheet lookup and creation without changing the selected worksheet.

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

```javascript
new SheetCollection(workbook)
```

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

Returns: `SheetCollection`.

### Members

#### Properties

| Property | Description |
|---|---|
| [count](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/count-property/llms-full.txt) | The count value of SheetCollection. |
| [workbook](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/workbook-property/llms-full.txt) | The workbook value of SheetCollection. |

#### Methods

| Method | Description |
|---|---|
| [add](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/add-method/llms-full.txt) | Create a sheet without changing selection. |
| [at](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/at-method/llms-full.txt) | Find a sheet by zero-based position. |
| [find](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/find-method/llms-full.txt) | Find a sheet or return undefined. |
| [get](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/get-method/llms-full.txt) | Find a sheet by case-insensitive name; throw when absent. |
| [getById](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/getbyid-method/llms-full.txt) | Find a sheet by stable ID. |
| [remove](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/remove-method/llms-full.txt) | Remove a sheet handle or ID; retain at least one sheet. |

### 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.

```javascript
function createSheetCollectionReport(control) {
    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 });

    const invoice = book.sheets.add('October invoice');
    invoice.cell('A1').setText('Customer invoice');
    return sheet;
}
```

### See Also

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

---

## In This Section

- [SheetCollection.add Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/add-method/llms-full.txt): SheetCollection.add method in the Node.js JavaScript API: Create a sheet without changing selection. Includes the syntax and a JavaScript example.
- [SheetCollection.at Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/at-method/llms-full.txt): SheetCollection.at method in the TX Sheet Control JavaScript API for Node.js: Find a sheet by zero-based position. Includes the syntax and a JavaScript example.
- [SheetCollection.count Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/count-property/llms-full.txt): SheetCollection.count property in the TX Sheet Control JavaScript API for Node.js, with its type number and a JavaScript example.
- [SheetCollection.find Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/find-method/llms-full.txt): SheetCollection.find method in the TX Sheet Control JavaScript API for Node.js: Find a sheet or return undefined. Includes the syntax and a JavaScript example.
- [SheetCollection.get Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/get-method/llms-full.txt): SheetCollection.get method in the TX Sheet Control JavaScript API for Node.js: Find a sheet by case-insensitive name; throw when absent.
- [SheetCollection.getById Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/getbyid-method/llms-full.txt): SheetCollection.getById method in the TX Sheet Control JavaScript API for Node.js: Find a sheet by stable ID. Includes the syntax and a JavaScript example.
- [SheetCollection.remove Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/remove-method/llms-full.txt): SheetCollection.remove method in the TX Sheet Control JavaScript API for Node.js: Remove a sheet handle or ID; retain at least one sheet.
- [SheetCollection.workbook Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/workbook-property/llms-full.txt): SheetCollection.workbook property in the TX Sheet Control JavaScript API for Node.js, with its type Workbook and a JavaScript example.

---

## Nearby

- **Previous:** [ServerSheetControl.workbook Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/serversheetcontrol/workbook-property/llms-full.txt)
- **Next:** [SheetCollection.add Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/sheetcollection/add-method/llms-full.txt)
