SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Class Sheet

    An ISheet represents a collection of elements (such as ranges, tables, etc) contained within and visualized through a view.

    This interface provides methods for accessing its elements and event handling.

    Most interactions with a sheet are done using either a range or ranges.

    While a sheet can be used stand-alone it is typically used within the context of a workbook.

    Implements

    Index
    • get "[toStringTag]"(): string

      Returns string

    • get isISheet(): true

      For runtime type checking.

      Returns true

    • Batches all 'transactional' changes until they have all be committed or rolled back.

      Parameters

      • Optionaloptions: string | ITransaction.OperationOptions

        Description of the operation or additional options. Used for tracking undo/redo and history. Default Value User Operation.

      Returns ITransaction

      Any changes that are made to this object will be reflected in the local record but not committed to the transactional store until the batch is popped.

      Useful for operations that are longer running but generally not recommended as it keeps a transaction open. doBatch is the preferred option.

    • Recalculates THIS sheet — Excel's "Calculate Sheet" (Shift+F9) / Worksheet.Calculate.

      Parameters

      • Optionalfull: boolean

        When true, recalculate every formula on the sheet. Otherwise only the ones whose inputs changed (plus volatiles), which is what Excel's Shift+F9 does.

      Returns Promise<ICalculation.Status>

      Distinct from getEntireRange().calculate(full), which marks the range dirty first and is therefore always a FORCE for those cells. This is the dirty-respecting sheet-scoped pass.

      Only the SEED is scoped to this sheet: dependents on other sheets still recalculate, and volatiles are still workbook-wide. Excel leaves both stale; being more current is the safe direction, and the volatile registry is drained per pass, so skipping them would deregister them outright.

    • Free all resources associated with the sheet.

      Returns void

      • Called by workbooks when the workbook is is closed.
      • This is different than delete which removes the sheet from the workbook.
    • Creates a cell that is not including at a coordinate but adopts all rendering.

      Parameters

      Returns ICell

      A detached ICell

      • Useful for previewing values such as tooltip, or what typed text would be entered as.
      • Does not add to the sheet but provides a standalone ICell.
      • If the coords are passed it will return disconnect cell update for that value.
    • Parses a formula expression and returns a transient formula object anchored to this sheet.

      Parameters

      • expression: string

        The formula expression to parse.

      • Optionalcoords: Partial<CellCoords>

        Optional anchor coordinates.

      • Optionaloptions: CreateFormulaOptions

        Optional parse options; the expression is storage text unless target is 'display'.

      Returns IFormula

      This is a convenience method for getCalculation().createFormula(expression, coords, options); like everything reached through the sheet's getCalculation, a bare reference (A2) resolves against THIS sheet rather than the selected one.

    • Removes from a container. This is usually the Workbook. If this is being used standalone this operation will throw an exception.

      Returns void

    • Provides a mechanism to perform a set of operations in a batch.

      Type Parameters

      • R

      Parameters

      • callback: (commit: ICommit) => R | Promise<R>

        A callback that performs multiple operations all within the same transaction.

      • Optionaloptions: string | ITransaction.OperationOptions

        Description of the operation or additional options. Used for tracking undo/redo and history. Default Value User Operation.

      Returns R | Promise<R>

      Writes are tracked automatically: a batch that performs no state updates (a read-only batch) is elided — the commit id is unchanged, no events fire, and nothing is added to the undo stack or commit log.

    • Returns a promise that will resolve to a copy of the current sheet.

      Returns Promise<Sheet>

    • Evaluates a formula in the context of the sheet and returns the resulting value.

      Parameters

      Returns Promise<Scalar | IRange<Scalar>>

      This is similar convenience method for getCalculation().createFormula(expression).evaluate(options).

    • Returns an iterator of ICells that match the results.

      Parameters

      Returns Iterator<ICell>

      This is the equivalent of getEntireRange().find.

    • Returns the ICalculation anchored to this sheet.

      Returns ICalculation

      The engine itself is workbook-wide; this is a view over it that supplies THIS sheet as the context whenever a caller doesn't name one. So an expression parsed or evaluated through it resolves a bare reference (A2) against this sheet — not against whichever sheet happens to be selected.

      That matters for anything anchored by coords alone, e.g. sheet.getCalculation().createFormula('=A2+B2', cell.getCoords()): reached through the workbook (IWorkbook.getCalculation) the same call has no sheet context and falls back to the active cell's sheet, which makes the parse depend on UI selection state. Pass an explicit coords.scope to override the anchor (a cross-sheet reference is unaffected either way — it names its own sheet).

    • Returns a ICell at the specified address.

      Parameters

      • Optionaladdress: ICell.Address

        Address of the cell. Omit for the selected cell — selection is modeled by the SDK (not a UI mode), and many operations default to it. getSelectedCell remains the explicit form.

      Returns ICell

    • The sheet's VBA code name, or null if it has none.

      Returns string | null

      The identifier VBA binds a sheet through — Sheet1.Range("A1") in a macro resolves by code name, never by tab name. It is a second, independent identity for the sheet: renaming the tab does not change it, and it is not the sheet's position. Excel's default happens to look positional (Sheet1, Sheet2, …) but drifts from position the moment sheets are reordered, inserted or deleted, so it can only be carried — never derived.

      Present on any workbook that has, or has ever had, a VBA project: it survives the project being stripped, so an .xlsx saved down from an .xlsm still carries code names. A workbook that never had one has none, and this is null throughout.

      Read-only. SheetXL preserves what a file declared and never mints one — a code name is assigned by the VBA editor, and inventing one would create a binding target no macro refers to. There is deliberately no setCodeName.

    • Returns the column width as a font unit.

      This is used as an informative tooltip.

      Parameters

      • pixelWidth: number

      Returns number

    • Returns the coords for the entire sheet.

      Returns Coords

      This is a lightweight call to ISheet.getEntireRange().getCoords().

    • A unique identifier for the record. This will never change.

      Returns string

      This enables the record to be identified across transactions and users in a collaborative environment. The id is store-issued (IStore.create); the store keys all state by it.

    • Returns the current index of the ISheet within its container.

      Returns number

      Will return -1 if not in a Workbook or other sheet container.

    • Returns the modules this sheet owns.

      Returns IModuleCollection

      A sheet's modules are stored by the sheet rather than tagged with its name, so the state a tag would allow — a module left behind pointing at a sheet that no longer exists — cannot occur: delete the sheet and its modules go with it, which is also what Excel does.

      These modules are scoped to the sheet (IModule.getScope), and scope is a visibility rule: a function declared here is not callable from a cell formula, on this sheet or any other. Only globally scoped modules contribute to the formula namespace.

      The VBA document module for this sheet lands here, joined to it by ISheet.getCodeName — for a document module the module name is the code name.

      As with IWorkbook.getScripts, the collection filters to TypeScript unless asked otherwise; imported VBA is read with getItems({ language: 'vba' }).

    • Returns the display name for the sheet.

      Returns string

    • The INameds visible from this sheet — what a formula written here can refer to.

      Returns INamedCollection

      The global items (every table among them, since a table name is always global) plus this sheet's own scoped names, with shadowing resolved: where a sheet-scoped name and a global share a name, only this sheet's is returned, because that is the one a formula here resolves to. Another sheet's scoped names are never included.

      Everything is anchored to THIS sheet, not the selected one: getByName resolves against it, and getByRanges reads unqualified coords as being on it — which is what lets this sheet's own selection be passed straight in.

      Use IWorkbook.getNames for every name in the workbook (a name manager), and ISheet.getTables for the tables that LIVE on this sheet — scope here is visibility, never location, so a table anchored to another sheet is still visible from this one.

    • Returns the uniform regions for the requested features across the whole sheet.

      Parameters

      Returns ICellRegions

      The partition operator belongs on the thing partitioned, and "where are the blocks in this sheet" is the question an agent actually has — the ICellRange flavor is how you constrain that query, not how you start it.

      Equivalent to getEntireRange().getRegions(…): the partition reads the feature indexes, so it costs the used cells rather than the address space.

    • Returns the runtime used for this sheet.

      Returns IRuntime

      This can not be set on the ISheet. This is managed by the sheet's container.

    • Returns the selected cell.

      Returns ICell

      This is a convenience method for 'getSelection().getCell()'.

    • Returns the statistics for the used cells of the sheet.

      Parameters

      • Optionaloptions: GetStatsOptions

        Iterator options the stats are created with — most usefully { onError: 'ignore' } so aggregate reads degrade instead of faulting on error values.

      Returns IRangeStats

      Equivalent to getUsedRange().getStats(…) except null-safe — an empty sheet returns empty statistics (getSize() === 0) rather than forcing the caller to branch on getUsedRange returning null.

    • Every committed update gives the record a new, strictly increasing version id.

      Returns number

      Used with getId to uniquely identify a version of the record.

      The id is an identity, not a per-record count: ids are drawn from a single store-wide sequence bumped once per commit, so all records written in the same commit share an id and a given record's ids increase but are not sequential.

      Records are immutable so a restore/revert doesn't change them — it repoints, and the version id reported is the one for the snapshot the store is currently at. Version ids are never reused: a write after an undo receives an id higher than any previously issued, so a stale reader can always detect the change.

    • Returns the current view settings View settings determine how the sheet is displayed and interacted with (e.g., frozen panes, zoom level, selection) but do not affect the underlying data itself.

      Returns ISheetView

      The ISheetView object representing the current view settings.

    • Returns true if the sheet has been closed.

      Returns boolean

    • Whether conditional formats on this sheet are recalculated as the sheet changes.

      Returns boolean

      Excel exposes this only to VBA (Worksheet.EnableFormatConditionsCalculation). It is carried so a workbook that turned it off keeps it off when saved; SheetXL still evaluates conditional formats either way.

    • Returns if the sheet has been deleted from its container.

      Returns boolean

    • Attempt to scroll the range into view.

      Parameters

      Returns Promise<boolean>

    • Reorders the ISheet with in the container. This is generally the tab order within an IWorkbook but may be the zIndex if the ISheets are movable. This only affects visual listings of the sheets (but selection doesn't change).

      Parameters

      Returns this

      This is zero-based.

    • See the tab color for the sheet.

      Parameters

      • color: string | IColor | null

        The color

      Returns this

      • If set to null the color will revert to the default.
      • The tab color is not used by the sheet but rather by the workbook.
    • Returns a string representation of an object.

      Returns string

    • Returns when all calculations are complete and there are no pending calculations.

      Returns Promise<ICalculation.Status>

      • Also waits for the load-time start: the pass ICellContainerOptions.calcOnLoad asks for. This is the settle point after constructing from JSON.
      • Otherwise a convenience method for getCalculation().ready(), which starts the engine if it has not been started.