> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reducto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# ExcelWorksheet

## `ExcelWorksheet`

`Excel.Worksheet`.

Import from `@reductoai/xlsx/officejs`.

### ExcelWorksheet properties

| Name | Type | Description |
| - | - | - |
| `autoFilter` | `AutoFilter` | read-only |
| `book` | `Book` | read-only Extension: the workbook state every handle shares. |
| `charts` | `ChartCollection` | read-only |
| `comments` | `ExcelCommentCollection` | read-only |
| `customProperties` | `WorksheetCustomPropertyCollection` | read-only |
| `freezePanes` | `WorksheetFreezePanes` | read-only |
| `horizontalPageBreaks` | `PageBreakCollection` | read-only |
| `id` | `string` | read-only |
| `model` | `Worksheet` | read-only Extension: the engine's sheet. |
| `name` | `string` | |
| `names` | `NamedItemCollection` | read-only Names scoped to this worksheet. |
| `notes` | `ExcelNoteCollection` | read-only |
| `pageLayout` | `PageLayout` | read-only |
| `pivotTables` | `PivotTableCollection` | read-only |
| `position` | `number` | |
| `protection` | `WorksheetProtection` | read-only |
| `scenarios` | `ScenarioCollection` | read-only Extension: What-If scenarios, VBA's `Worksheet.Scenarios`. |
| `shapes` | `ShapeCollection` | read-only |
| `showGridlines` | `boolean` | |
| `showHeadings` | `boolean` | |
| `slicers` | `SlicerCollection` | read-only |
| `standardHeight` | `number` | read-only The default row height in points. |
| `standardWidth` | `number` | The default column width in characters of the Normal style's digit, as Excel's Standard Width. |
| `tabColor` | `string` | `#RRGGBB`, or "" for none. |
| `tabId` | `number` | read-only The sheet's `sheetId`, which stays with it through moves. |
| `tables` | `TableCollection` | read-only |
| `verticalPageBreaks` | `PageBreakCollection` | read-only |
| `visibility` | `SheetVisibility` | |

### `ExcelWorksheet.activate()`

```ts theme={null}
activate(): void
```

### `ExcelWorksheet.calculate()`

```ts theme={null}
calculate(_markAllDirty?: boolean): void
```

### `ExcelWorksheet.copy()`

```ts theme={null}
copy(
  positionType?: "None" | "Before" | "After" | "Beginning" | "End",
  relativeTo?: ExcelWorksheet,
): ExcelWorksheet
```

A copy named as Excel names one ("Sheet1 (2)"); "None" puts it right after this sheet.

### `ExcelWorksheet.defaultColumnWidthPx()`

```ts theme={null}
defaultColumnWidthPx(): number
```

Extension: the default column width in pixels.

### `ExcelWorksheet.defaultRowHeightPt()`

```ts theme={null}
defaultRowHeightPt(): number
```

Extension: the default row height in points.

### `ExcelWorksheet.delete()`

```ts theme={null}
delete(): void
```

References to the sheet become `#REF!`; this handle and its ranges stop working.

### `ExcelWorksheet.evaluate()`

```ts theme={null}
evaluate(
  formula: string,
): ClientResult<string | number | boolean | (string | number | boolean)[][]>
```

What `formula` computes on this sheet: a value, or the rows of a reference or array.

### `ExcelWorksheet.findAll()`

```ts theme={null}
findAll(text: string, criteria?: ReplaceCriteria): RangeAreas
```

Every cell whose formula or constant matches; throws when none does.

### `ExcelWorksheet.findAllOrNullObject()`

```ts theme={null}
findAllOrNullObject(
  text: string,
  criteria?: ReplaceCriteria,
): RangeAreas & { isNullObject: boolean }
```

### `ExcelWorksheet.getCell()`

```ts theme={null}
getCell(row: number, column: number): ExcelRange
```

### `ExcelWorksheet.getNext()`

```ts theme={null}
getNext(visibleOnly?: boolean): ExcelWorksheet
```

The next sheet in tab order; throws at the last one.

### `ExcelWorksheet.getNextOrNullObject()`

```ts theme={null}
getNextOrNullObject(visibleOnly?: boolean): ExcelWorksheet & { isNullObject: boolean }
```

### `ExcelWorksheet.getPrevious()`

```ts theme={null}
getPrevious(visibleOnly?: boolean): ExcelWorksheet
```

### `ExcelWorksheet.getPreviousOrNullObject()`

```ts theme={null}
getPreviousOrNullObject(
  visibleOnly?: boolean,
): ExcelWorksheet & { isNullObject: boolean }
```

### `ExcelWorksheet.getRange()`

```ts theme={null}
getRange(address?: string): ExcelRange
```

The whole sheet without an address; otherwise an A1 address on this sheet or a defined name.

### `ExcelWorksheet.getRangeByIndexes()`

```ts theme={null}
getRangeByIndexes(
  startRow: number,
  startColumn: number,
  rowCount: number,
  columnCount: number,
): ExcelRange
```

### `ExcelWorksheet.getRanges()`

```ts theme={null}
getRanges(address?: string): RangeAreas
```

Comma- or semicolon-separated addresses or names; the whole sheet without one.

### `ExcelWorksheet.getUsedRange()`

```ts theme={null}
getUsedRange(valuesOnly?: boolean): ExcelRange
```

The smallest rectangle holding every value or format; A1 on an empty sheet.

### `ExcelWorksheet.getUsedRangeOrNullObject()`

```ts theme={null}
getUsedRangeOrNullObject(valuesOnly?: boolean): ExcelRange & { isNullObject: boolean }
```

### `ExcelWorksheet.replaceAll()`

```ts theme={null}
replaceAll(
  text: string,
  replacement: string,
  criteria?: ReplaceCriteria,
): ClientResult<number>
```

Replace All over the sheet; returns the number of cells changed.

### `ExcelWorksheet.set()`

```ts theme={null}
set(
  properties: ExcelWorksheet | UpdateData<ExcelWorksheet>,
  options?: UpdateOptions,
): void
```

Sets several properties at once; a navigation member takes a nested batch.

### `ExcelWorksheet.showOutlineLevels()`

```ts theme={null}
showOutlineLevels(rowLevels: number, columnLevels: number): void
```

Shows `rowLevels` and `columnLevels` outline levels (0 to 8); 0 leaves that direction as it is.

## `WorksheetFreezePanes`

`Excel.WorksheetFreezePanes`.

Import from `@reductoai/xlsx/officejs`.

### `WorksheetFreezePanes.freezeAt()`

```ts theme={null}
freezeAt(frozenRange: string | ExcelRange): void
```

Freezes the rows above and the columns left of the range's bottom-right corner, inclusive.

### `WorksheetFreezePanes.freezeColumns()`

```ts theme={null}
freezeColumns(count?: number): void
```

### `WorksheetFreezePanes.freezeRows()`

```ts theme={null}
freezeRows(count?: number): void
```

### `WorksheetFreezePanes.getLocation()`

```ts theme={null}
getLocation(): ExcelRange
```

The frozen cells; throws when nothing is frozen.

### `WorksheetFreezePanes.getLocationOrNullObject()`

```ts theme={null}
getLocationOrNullObject(): ExcelRange & { isNullObject: boolean }
```

### `WorksheetFreezePanes.unfreeze()`

```ts theme={null}
unfreeze(): void
```

## `WorksheetProtection`

`Excel.WorksheetProtection`: `<sheetProtection>`; passwords are stored as Excel's SHA-512 hash.

Import from `@reductoai/xlsx/officejs`.

### WorksheetProtection properties

| Name | Type | Description |
| - | - | - |
| `allowEditRanges` | `AllowEditRangeCollection` | read-only |
| `canPauseProtection` | `boolean` | read-only |
| `isPasswordProtected` | `boolean` | read-only |
| `isPaused` | `boolean` | read-only |
| `options` | `Required<WorksheetProtectionOptions>` | read-only |
| `protected` | `boolean` | read-only |
| `savedOptions` | `Required<WorksheetProtectionOptions>` | read-only |

### `WorksheetProtection.checkPassword()`

```ts theme={null}
checkPassword(password?: string): ClientResult<boolean>
```

### `WorksheetProtection.pauseProtection()`

```ts theme={null}
pauseProtection(password?: string): void
```

Lifts protection for this session only; the file stays protected.

### `WorksheetProtection.protect()`

```ts theme={null}
protect(options?: WorksheetProtectionOptions, password?: string): void
```

Throws when the sheet is already protected, as Excel does.

### `WorksheetProtection.resumeProtection()`

```ts theme={null}
resumeProtection(): void
```

### `WorksheetProtection.setPassword()`

```ts theme={null}
setPassword(password?: string): void
```

Changes the password of a protected sheet; none removes it.

### `WorksheetProtection.unprotect()`

```ts theme={null}
unprotect(password?: string): void
```

### `WorksheetProtection.updateOptions()`

```ts theme={null}
updateOptions(options: WorksheetProtectionOptions): void
```

## `PageLayout`

`Excel.PageLayout`: `<printOptions>`, `<pageMargins>`, `<pageSetup>`, `<headerFooter>` and the print names.

Import from `@reductoai/xlsx/officejs`.

### PageLayout properties

| Name | Type | Description |
| - | - | - |
| `alignMarginsHeaderFooter` | `boolean` | |
| `blackAndWhite` | `boolean` | |
| `bottomMargin` | `number` | |
| `centerHorizontally` | `boolean` | |
| `centerVertically` | `boolean` | |
| `draftMode` | `boolean` | |
| `firstPageNumber` | `number \| ""` | "" when Excel numbers pages itself. |
| `footerMargin` | `number` | |
| `headerMargin` | `number` | |
| `headersFooters` | `HeaderFooterGroup` | read-only |
| `leftMargin` | `number` | |
| `orientation` | `PageOrientation` | |
| `paperSize` | `"Letter" \| "LetterSmall" \| "Tabloid" \| "Ledger" \| "Legal" \| "Statement" \| "Executive" \| "A3" \| "A4" \| "A4Small" \| "A5" \| "B4" \| "B5" \| "Folio" \| "Quatro" \| "Paper10x14" \| "Paper11x17" \| "Note" \| "Envelope9" \| "Envelope10" \| "Envelope11" \| "Envelope12" \| "Envelope14" \| "Csheet" \| "Dsheet" \| "Esheet" \| "EnvelopeDL" \| "EnvelopeC5" \| "EnvelopeC3" \| "EnvelopeC4" \| "EnvelopeC6" \| "EnvelopeC65" \| "EnvelopeB4" \| "EnvelopeB5" \| "EnvelopeB6" \| "EnvelopeItaly" \| "EnvelopeMonarch" \| "EnvelopePersonal" \| "FanfoldUS" \| "FanfoldStdGerman" \| "FanfoldLegalGerman"` | |
| `printComments` | `PrintComments` | |
| `printErrors` | `PrintErrorType` | |
| `printGridlines` | `boolean` | |
| `printHeadings` | `boolean` | |
| `printOrder` | `PrintOrder` | |
| `printQuality` | `number[]` | Horizontal and vertical dots per inch; empty when the file records none. |
| `rightMargin` | `number` | |
| `topMargin` | `number` | |
| `zoom` | `PageLayoutZoomOptions` | |

### `PageLayout.getPrintArea()`

```ts theme={null}
getPrintArea(): RangeAreas
```

### `PageLayout.getPrintAreaOrNullObject()`

```ts theme={null}
getPrintAreaOrNullObject(): RangeAreas & { isNullObject: boolean }
```

### `PageLayout.getPrintTitleColumns()`

```ts theme={null}
getPrintTitleColumns(): ExcelRange
```

### `PageLayout.getPrintTitleColumnsOrNullObject()`

```ts theme={null}
getPrintTitleColumnsOrNullObject(): ExcelRange & { isNullObject: boolean }
```

### `PageLayout.getPrintTitleRows()`

```ts theme={null}
getPrintTitleRows(): ExcelRange
```

### `PageLayout.getPrintTitleRowsOrNullObject()`

```ts theme={null}
getPrintTitleRowsOrNullObject(): ExcelRange & { isNullObject: boolean }
```

### `PageLayout.set()`

```ts theme={null}
set(properties: PageLayout | UpdateData<PageLayout>, options?: UpdateOptions): void
```

Sets several properties at once; a navigation member takes a nested batch.

### `PageLayout.setPrintArea()`

```ts theme={null}
setPrintArea(printArea: string | ExcelRange | RangeAreas): void
```

A range, areas, or an address such as "A1:D20, F1:G5"; "" clears it, as VBA's `PrintArea = ""`.

### `PageLayout.setPrintMargins()`

```ts theme={null}
setPrintMargins(unit: PrintMarginUnit, options: PageLayoutMarginOptions): void
```

### `PageLayout.setPrintTitleColumns()`

```ts theme={null}
setPrintTitleColumns(printTitleColumns: string | ExcelRange): void
```

### `PageLayout.setPrintTitleRows()`

```ts theme={null}
setPrintTitleRows(printTitleRows: string | ExcelRange): void
```

Whole rows such as "1:2"; other ranges use their rows; "" clears them.
