# Operations Class

# Constructors

# constructor

+ new Operations(config: Config, dependencyGraph: DependencyGraph, columnSearch: ColumnSearchStrategy, cellContentParser: CellContentParser, parser: ParserWithCaching, stats: Statistics, lazilyTransformingAstService: LazilyTransformingAstService, namedExpressions: NamedExpressions, arraySizePredictor: ArraySizePredictor): Operations

Defined in src/Operations.ts:160 (opens new window)

Parameters:

Name Type
config Config
dependencyGraph DependencyGraph
columnSearch ColumnSearchStrategy
cellContentParser CellContentParser
parser ParserWithCaching
stats Statistics
lazilyTransformingAstService LazilyTransformingAstService
namedExpressions NamedExpressions
arraySizePredictor ArraySizePredictor

Returns: Operations

# Methods

# addColumns

addColumns(cmd: AddColumnsCommand): void

Defined in src/Operations.ts:203 (opens new window)

Parameters:

Name Type
cmd AddColumnsCommand

Returns: void


# addNamedExpression

addNamedExpression(expressionName: string, expression: RawCellContent, sheetId?: Maybe‹number›, options?: NamedExpressionOptions): void

Defined in src/Operations.ts:420 (opens new window)

Parameters:

Name Type
expressionName string
expression RawCellContent
sheetId? Maybe‹number›
options? NamedExpressionOptions

Returns: void


# addPlaceholderSheetWithId

addPlaceholderSheetWithId(sheetId: number, name: string): void

Defined in src/Operations.ts:253 (opens new window)

Adds a placeholder sheet with a specific ID for undo operations. Used to restore previously merged placeholder sheets.

Note: Unlike addSheetWithId, this does NOT call dependencyGraph.addSheet() because placeholders don't need dirty marking or strategy changes - they only need to exist in the mappings so formulas can reference them again.

Parameters:

Name Type
sheetId number
name string

Returns: void


# addRows

addRows(cmd: AddRowsCommand): void

Defined in src/Operations.ts:197 (opens new window)

Parameters:

Name Type
cmd AddRowsCommand

Returns: void


# addSheet

addSheet(name?: undefined | string): object

Defined in src/Operations.ts:231 (opens new window)

Adds a new sheet to the workbook.

Parameters:

Name Type
name? undefined | string

Returns: object

  • sheetId: number

  • sheetName: string


# addSheetWithId

addSheetWithId(sheetId: number, name: string): void

Defined in src/Operations.ts:240 (opens new window)

Adds a sheet with a specific ID for redo operations.

Parameters:

Name Type
sheetId number
name string

Returns: void


# changeNamedExpressionExpression

changeNamedExpressionExpression(expressionName: string, newExpression: RawCellContent, sheetId?: Maybe‹number›, options?: NamedExpressionOptions): [InternalNamedExpression, ClipboardCell]

Defined in src/Operations.ts:433 (opens new window)

Parameters:

Name Type
expressionName string
newExpression RawCellContent
sheetId? Maybe‹number›
options? NamedExpressionOptions

Returns: [InternalNamedExpression, ClipboardCell]


# clearSheet

clearSheet(sheetId: number): void

Defined in src/Operations.ts:223 (opens new window)

Clears the sheet content.

Parameters:

Name Type
sheetId number

Returns: void


# ensureItIsPossibleToMoveCells

ensureItIsPossibleToMoveCells(sourceLeftCorner: SimpleCellAddress, width: number, height: number, destinationLeftCorner: SimpleCellAddress): void

Defined in src/Operations.ts:466 (opens new window)

Parameters:

Name Type
sourceLeftCorner SimpleCellAddress
width number
height number
destinationLeftCorner SimpleCellAddress

Returns: void


# forceApplyPostponedTransformations

forceApplyPostponedTransformations(): void

Defined in src/Operations.ts:740 (opens new window)

Returns: void


# getAndClearContentChanges

getAndClearContentChanges(): ContentChanges

Defined in src/Operations.ts:734 (opens new window)

Returns: ContentChanges


# getClipboardCell

getClipboardCell(address: SimpleCellAddress): ClipboardCell

Defined in src/Operations.ts:549 (opens new window)

Parameters:

Name Type
address SimpleCellAddress

Returns: ClipboardCell


# getOldContent

getOldContent(address: SimpleCellAddress): [SimpleCellAddress, ClipboardCell]

Defined in src/Operations.ts:530 (opens new window)

Parameters:

Name Type
address SimpleCellAddress

Returns: [SimpleCellAddress, ClipboardCell]


# getRangeClipboardCells

getRangeClipboardCells(range: AbsoluteCellRange): [SimpleCellAddress, ClipboardCell][]

Defined in src/Operations.ts:590 (opens new window)

Parameters:

Name Type
range AbsoluteCellRange

Returns: [SimpleCellAddress, ClipboardCell][]


# getSheetClipboardCells

getSheetClipboardCells(sheet: number): ClipboardCell[][]

Defined in src/Operations.ts:574 (opens new window)

Parameters:

Name Type
sheet number

Returns: ClipboardCell[][]


# moveCells

moveCells(sourceLeftCorner: SimpleCellAddress, width: number, height: number, destinationLeftCorner: SimpleCellAddress): MoveCellsResult

Defined in src/Operations.ts:343 (opens new window)

Parameters:

Name Type
sourceLeftCorner SimpleCellAddress
width number
height number
destinationLeftCorner SimpleCellAddress

Returns: MoveCellsResult


# moveColumns

moveColumns(sheet: number, startColumn: number, numberOfColumns: number, targetColumn: number): number

Defined in src/Operations.ts:324 (opens new window)

Parameters:

Name Type
sheet number
startColumn number
numberOfColumns number
targetColumn number

Returns: number


# moveRows

moveRows(sheet: number, startRow: number, numberOfRows: number, targetRow: number): number

Defined in src/Operations.ts:305 (opens new window)

Parameters:

Name Type
sheet number
startRow number
numberOfRows number
targetRow number

Returns: number


# removeColumns

removeColumns(cmd: RemoveColumnsCommand): ColumnsRemoval[]

Defined in src/Operations.ts:209 (opens new window)

Parameters:

Name Type
cmd RemoveColumnsCommand

Returns: ColumnsRemoval[]


# removeNamedExpression

removeNamedExpression(expressionName: string, sheetId?: Maybe‹number›): [InternalNamedExpression, ClipboardCell]

Defined in src/Operations.ts:447 (opens new window)

Parameters:

Name Type
expressionName string
sheetId? Maybe‹number›

Returns: [InternalNamedExpression, ClipboardCell]


# removeRows

removeRows(cmd: RemoveRowsCommand): RowsRemoval[]

Defined in src/Operations.ts:186 (opens new window)

Parameters:

Name Type
cmd RemoveRowsCommand

Returns: RowsRemoval[]


# removeSheet

removeSheet(sheetId: number): [InternalNamedExpression, ClipboardCell][]

Defined in src/Operations.ts:261 (opens new window)

Removes a sheet from the workbook.

Parameters:

Name Type
sheetId number

Returns: [InternalNamedExpression, ClipboardCell][]


# removeSheetByName

removeSheetByName(sheetName: string): [InternalNamedExpression‹›, ClipboardCell][]

Defined in src/Operations.ts:273 (opens new window)

Removes a sheet from the workbook by name.

Parameters:

Name Type
sheetName string

Returns: [InternalNamedExpression‹›, ClipboardCell][]


# renameSheet

renameSheet(sheetId: number, newName: string): object

Defined in src/Operations.ts:281 (opens new window)

Renames a sheet in the workbook.

Parameters:

Name Type
sheetId number
newName string

Returns: object

  • mergedPlaceholderSheetId? : Maybe‹number›

  • previousDisplayName: Maybe‹string›

  • version? : Maybe‹number›


# restoreCell

restoreCell(address: SimpleCellAddress, clipboardCell: ClipboardCell): void

Defined in src/Operations.ts:509 (opens new window)

Restores a single cell.

Parameters:

Name Type
address SimpleCellAddress
clipboardCell ClipboardCell

Returns: void


# restoreClipboardCells

restoreClipboardCells(sourceSheetId: number, cells: IterableIterator‹[SimpleCellAddress, ClipboardCell]›): string[]

Defined in src/Operations.ts:493 (opens new window)

Parameters:

Name Type
sourceSheetId number
cells IterableIterator‹[SimpleCellAddress, ClipboardCell]›

Returns: string[]


# restoreNamedExpression

restoreNamedExpression(namedExpression: InternalNamedExpression, content: ClipboardCell, sheetId?: Maybe‹number›): void

Defined in src/Operations.ts:426 (opens new window)

Parameters:

Name Type
namedExpression InternalNamedExpression
content ClipboardCell
sheetId? Maybe‹number›

Returns: void


# rowEffectivelyNotInSheet

rowEffectivelyNotInSheet(row: number, sheet: number): boolean

Defined in src/Operations.ts:729 (opens new window)

Returns true if row number is outside of given sheet.

Parameters:

Name Type Description
row number row number
sheet number sheet ID number

Returns: boolean


# setCellContent

setCellContent(address: SimpleCellAddress, newCellContent: RawCellContent): [SimpleCellAddress, ClipboardCell]

Defined in src/Operations.ts:598 (opens new window)

Parameters:

Name Type
address SimpleCellAddress
newCellContent RawCellContent

Returns: [SimpleCellAddress, ClipboardCell]


# setCellEmpty

setCellEmpty(address: SimpleCellAddress): void

Defined in src/Operations.ts:695 (opens new window)

Sets cell content to an empty value. Creates an EmptyCellVertex and updates the dependency graph and column search index.

Parameters:

Name Type
address SimpleCellAddress

Returns: void


# setColumnOrder

setColumnOrder(sheetId: number, columnMapping: [number, number][]): [SimpleCellAddress, ClipboardCell][]

Defined in src/Operations.ts:399 (opens new window)

Parameters:

Name Type
sheetId number
columnMapping [number, number][]

Returns: [SimpleCellAddress, ClipboardCell][]


# setFormulaToCell

setFormulaToCell(address: SimpleCellAddress, size: ArraySize, __namedParameters: object): void

Defined in src/Operations.ts:663 (opens new window)

Sets cell content to a formula. Creates a ScalarFormulaVertex and updates the dependency graph and column search index.

Parameters:

address: SimpleCellAddress

size: ArraySize

__namedParameters: object

Name Type
ast Ast
dependencies RelativeDependency[]
hasStructuralChangeFunction boolean
hasVolatileFunction boolean

Returns: void


# setFormulaToCellFromCache

setFormulaToCellFromCache(formulaHash: string, address: SimpleCellAddress): void

Defined in src/Operations.ts:709 (opens new window)

Parameters:

Name Type
formulaHash string
address SimpleCellAddress

Returns: void


# setParsingErrorToCell

setParsingErrorToCell(rawInput: string, errors: ParsingError[], address: SimpleCellAddress): void

Defined in src/Operations.ts:648 (opens new window)

Sets cell content to an instance of parsing error. Creates a ParsingErrorVertex and updates the dependency graph and column search index.

Parameters:

Name Type
rawInput string
errors ParsingError[]
address SimpleCellAddress

Returns: void


# setRowOrder

setRowOrder(sheetId: number, rowMapping: [number, number][]): [SimpleCellAddress, ClipboardCell][]

Defined in src/Operations.ts:378 (opens new window)

Parameters:

Name Type
sheetId number
rowMapping [number, number][]

Returns: [SimpleCellAddress, ClipboardCell][]


# setSheetContent

setSheetContent(sheetId: number, newSheetContent: RawCellContent[][]): void

Defined in src/Operations.ts:634 (opens new window)

Parameters:

Name Type
sheetId number
newSheetContent RawCellContent[][]

Returns: void


# setValueToCell

setValueToCell(value: RawAndParsedValue, address: SimpleCellAddress): void

Defined in src/Operations.ts:681 (opens new window)

Sets cell content to a value. Creates a ValueCellVertex and updates the dependency graph and column search index.

Parameters:

Name Type
value RawAndParsedValue
address SimpleCellAddress

Returns: void

Join HyperFormula team as a Senior Software Engineer See the role and apply