# SheetCollection Class

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

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Class
- **Path:** TX Sheet Control > API Reference > TypeScript API > Browser Editor > SheetCollection Class
- **905 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/sheetcollection/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/sheetcollection/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/sheetcollection/llms-full.txt

---

Stable sheet lookup and creation without changing the selected worksheet.

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

ES module import: `import { SheetCollection } from '@txtextcontrol/tx-sheet-control';`.

### Constructor

```typescript
new SheetCollection(workbook: Workbook): SheetCollection
```

| 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/typescript-api/browser/sheetcollection/count-property/llms-full.txt) | The count value of SheetCollection. |
| [workbook](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/sheetcollection/workbook-property/llms-full.txt) | The workbook value of SheetCollection. |

#### Methods

| Method | Description |
|---|---|
| [add](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/sheetcollection/add-method/llms-full.txt) | Create a sheet without changing selection. |
| [at](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/sheetcollection/at-method/llms-full.txt) | Find a sheet by zero-based position. |
| [find](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/sheetcollection/find-method/llms-full.txt) | Find a sheet or return undefined. |
| [get](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/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/typescript-api/browser/sheetcollection/getbyid-method/llms-full.txt) | Find a sheet by stable ID. |
| [remove](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/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.

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

function createSheetCollectionReport(book: 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

- [TypeScript Browser Editor API](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/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/typescript-api/browser/sheetcollection/add-method/llms-full.txt): SheetCollection.add method in the TX Sheet Control TypeScript API for the browser: Create a sheet without changing selection.
- [SheetCollection.at Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/sheetcollection/at-method/llms-full.txt): SheetCollection.at method in the TX Sheet Control TypeScript API for the browser, with the return type Worksheet and a TypeScript example.
- [SheetCollection.count Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/sheetcollection/count-property/llms-full.txt): SheetCollection.count property in the TX Sheet Control TypeScript API for the browser, with its type number and a TypeScript example.
- [SheetCollection.find Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/sheetcollection/find-method/llms-full.txt): SheetCollection.find method in the TX Sheet Control TypeScript API for the browser, with the return type Worksheet | undefined and a TypeScript example.
- [SheetCollection.get Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/sheetcollection/get-method/llms-full.txt): SheetCollection.get method in the TX Sheet Control TypeScript API for the browser: Find a sheet by case-insensitive name; throw when absent.
- [SheetCollection.getById Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/sheetcollection/getbyid-method/llms-full.txt): SheetCollection.getById method in the TX Sheet Control TypeScript API for the browser: Find a sheet by stable ID. Includes the syntax and a TypeScript example.
- [SheetCollection.remove Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/sheetcollection/remove-method/llms-full.txt): SheetCollection.remove method in the TX Sheet Control TypeScript API for the browser: Remove a sheet handle or ID; retain at least one sheet.
- [SheetCollection.workbook Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/sheetcollection/workbook-property/llms-full.txt): SheetCollection.workbook property in the TX Sheet Control TypeScript API for the browser, with its type Workbook and a TypeScript example.

---

## Nearby

- **Previous:** [SHAPE_TYPES Constant](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/shape-types-constant/llms-full.txt)
- **Next:** [SheetCollection.add Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/sheetcollection/add-method/llms-full.txt)
