# Worksheet Class

> Worksheet class in the browser TypeScript API: A stable sheet identity; access never activates the worksheet, and its feature collections share its lifecycle.

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

---

A stable sheet identity. Access never activates a worksheet. Feature collections share the existing worksheet identity and lifecycle validation.

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

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

### Constructor

```typescript
new Worksheet(workbook: Workbook, id: string): Worksheet
```

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `workbook` | `Workbook` | No | Value matching workbook's declared type and the owning object's validation rules. |
| `id` | `string` | No | Stable identity in the owning document/collection. |

Returns: `Worksheet`.

### Members

#### Properties

| Property | Description |
|---|---|
| [charts](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/charts-property/llms-full.txt) | The charts value of Worksheet. |
| [columns](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/columns-property/llms-full.txt) | The columns value of Worksheet. |
| [drawings](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/drawings-property/llms-full.txt) | The drawings value of Worksheet. |
| [id](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/id-property/llms-full.txt) | The id value of Worksheet. |
| [name](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/name-property/llms-full.txt) | The name value of Worksheet. |
| [names](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/names-property/llms-full.txt) | The names value of Worksheet. |
| [print](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/print-property/llms-full.txt) | The print value of Worksheet. |
| [protection](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/protection-property/llms-full.txt) | The protection value of Worksheet. |
| [rows](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/rows-property/llms-full.txt) | The rows value of Worksheet. |
| [tabColor](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/tabcolor-property/llms-full.txt) | Persisted sRGB tab color, or null for the default appearance. |
| [tables](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/tables-property/llms-full.txt) | The tables value of Worksheet. |
| [validation](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/validation-property/llms-full.txt) | The validation value of Worksheet. |
| [viewport](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/viewport-property/llms-full.txt) | The viewport value of Worksheet. |
| [workbook](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/workbook-property/llms-full.txt) | The workbook value of Worksheet. |

#### Methods

| Method | Description |
|---|---|
| [addSparklines](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/addsparklines-method/llms-full.txt) | Adds sparklines using A1 data/location ranges in one undoable sheet-scoped transaction. |
| [cell](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/cell-method/llms-full.txt) | Create an A1 or zero-based coordinate cell handle. |
| [clearSparklines](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/clearsparklines-method/llms-full.txt) | Removes sparklines in an A1 destination range (or all when omitted), retaining source cells. |
| [duplicate](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/duplicate-method/llms-full.txt) | Duplicates this worksheet with distinct table identities/names, preserving cells and formatting. |
| [getSparklineGroups](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/getsparklinegroups-method/llms-full.txt) | Reads detached sparkline definitions on this sheet without activating it. |
| [move](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/move-method/llms-full.txt) | Reorders this worksheet within its group; index is zero-based. |
| [range](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/range-method/llms-full.txt) | Create an A1 range handle. |
| [remove](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/remove-method/llms-full.txt) | Remove this worksheet. |
| [rename](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/rename-method/llms-full.txt) | Rename the sheet while preserving identity and qualified cell references. |
| [setTabColor](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/settabcolor-method/llms-full.txt) | Sets/clears the tab color in one undoable operation; rejects colors outside #RRGGBB. |
| [updateSparklineGroup](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/updatesparklinegroup-method/llms-full.txt) | Updates an existing group by stable ID; invalid or stale handles reject before mutation. |

### 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 createWorksheetReport(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 });

    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)
- [pivotTables](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/pivottables-property/llms-full.txt) — Configure and refresh worksheet pivot tables.

---

## In This Section

- [Worksheet.addSparklines Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/addsparklines-method/llms-full.txt): Worksheet.addSparklines method in the browser TypeScript API: Adds sparklines using A1 data/location ranges in one undoable sheet-scoped transaction.
- [Worksheet.cell Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/cell-method/llms-full.txt): Worksheet.cell method in the TX Sheet Control TypeScript API for the browser: Create an A1 or zero-based coordinate cell handle.
- [Worksheet.charts Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/charts-property/llms-full.txt): Worksheet.charts property in the TX Sheet Control TypeScript API for the browser, with its type ChartCollection and a TypeScript example.
- [Worksheet.clearSparklines Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/clearsparklines-method/llms-full.txt): Worksheet.clearSparklines method in the browser TypeScript API: Removes sparklines in an A1 destination range (or all when omitted), retaining source cells.
- [Worksheet.columns Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/columns-property/llms-full.txt): Worksheet.columns property in the TX Sheet Control TypeScript API for the browser, with its type DimensionCollection and a TypeScript example.
- [Worksheet.drawings Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/drawings-property/llms-full.txt): Worksheet.drawings property in the TX Sheet Control TypeScript API for the browser, with its type DrawingCollection and a TypeScript example.
- [Worksheet.duplicate Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/duplicate-method/llms-full.txt): Worksheet.duplicate method in the browser TypeScript API: Duplicates this worksheet with distinct table identities/names, preserving cells and formatting.
- [Worksheet.getSparklineGroups Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/getsparklinegroups-method/llms-full.txt): Worksheet.getSparklineGroups method in the browser TypeScript API: Reads detached sparkline definitions on this sheet without activating it.
- [Worksheet.id Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/id-property/llms-full.txt): Worksheet.id property in the TX Sheet Control TypeScript API for the browser, with its type string and a TypeScript example.
- [Worksheet.move Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/move-method/llms-full.txt): Worksheet.move method in the TX Sheet Control TypeScript API for the browser: Reorders this worksheet within its group; index is zero-based.
- [Worksheet.name Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/name-property/llms-full.txt): Worksheet.name property in the TX Sheet Control TypeScript API for the browser, with its type string and a TypeScript example.
- [Worksheet.names Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/names-property/llms-full.txt): Worksheet.names property in the TX Sheet Control TypeScript API for the browser, with its type NamedRangeCollection and a TypeScript example.
- [Worksheet.pivotTables Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/pivottables-property/llms-full.txt): Worksheet.pivotTables property in the TX Sheet Control TypeScript API for the browser: The pivot collection whose reports are on this destination worksheet.
- [Worksheet.print Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/print-property/llms-full.txt): Worksheet.print property in the TX Sheet Control TypeScript API for the browser, with its type SheetPrint and a TypeScript example.
- [Worksheet.protection Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/protection-property/llms-full.txt): Worksheet.protection property in the TX Sheet Control TypeScript API for the browser, with its type SheetProtection and a TypeScript example.
- [Worksheet.range Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/range-method/llms-full.txt): Worksheet.range method in the TX Sheet Control TypeScript API for the browser: Create an A1 range handle. Includes the syntax and a TypeScript example.
- [Worksheet.remove Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/remove-method/llms-full.txt): Worksheet.remove method in the TX Sheet Control TypeScript API for the browser: Remove this worksheet. Includes the syntax and a TypeScript example.
- [Worksheet.rename Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/rename-method/llms-full.txt): Worksheet.rename method in the TX Sheet Control TypeScript API for the browser: Rename the sheet while preserving identity and qualified cell references.
- [Worksheet.rows Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/rows-property/llms-full.txt): Worksheet.rows property in the TX Sheet Control TypeScript API for the browser, with its type DimensionCollection and a TypeScript example.
- [Worksheet.setTabColor Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/settabcolor-method/llms-full.txt): Worksheet.setTabColor method in the TX Sheet Control TypeScript API for the browser: Sets/clears the tab color in one undoable operation.
- [Worksheet.tabColor Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/tabcolor-property/llms-full.txt): Worksheet.tabColor property in the TX Sheet Control TypeScript API for the browser: Persisted sRGB tab color, or null for the default appearance.
- [Worksheet.tables Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/tables-property/llms-full.txt): Worksheet.tables property in the TX Sheet Control TypeScript API for the browser, with its type TableCollection and a TypeScript example.
- [Worksheet.updateSparklineGroup Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/updatesparklinegroup-method/llms-full.txt): Worksheet.updateSparklineGroup method in the TX Sheet Control TypeScript API for the browser: Updates an existing group by stable ID.
- [Worksheet.validation Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/validation-property/llms-full.txt): Worksheet.validation property in the TX Sheet Control TypeScript API for the browser, with its type SheetValidation and a TypeScript example.
- [Worksheet.viewport Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/viewport-property/llms-full.txt): Worksheet.viewport property in the TX Sheet Control TypeScript API for the browser, with its type SheetView and a TypeScript example.
- [Worksheet.workbook Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/workbook-property/llms-full.txt): Worksheet.workbook property in the TX Sheet Control TypeScript API for the browser, with its type Workbook and a TypeScript example.

---

## Nearby

- **Previous:** [WorkbookSearch.replace Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/workbooksearch/replace-method/llms-full.txt)
- **Next:** [Worksheet.addSparklines Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/worksheet/addsparklines-method/llms-full.txt)
