TX Sheet Control

ServerSheetControl.batch Method

Method

Apply serializable compatibility commands atomically.

Owner: ServerSheetControl. Package: @txtextcontrol/tx-sheet-control-server. Version: 2.0.0.

Syntax

batch(commands: readonly WorkbookCommand[]): unknown[]

Parameters

ParameterTypeOptionalDescription
commandsreadonly WorkbookCommand[]NoOperation-specific input; see the owning type for units and scope.

Return Value

unknown[].

A detached result or a handle bound to the same worksheet.

Examples

Use a fresh sample workbook for this example. In the browser pass editor.workbook; in Node.js pass the server control. Document-bound objects are obtained from that same owner.

import type { ServerSheetControl } from '@txtextcontrol/tx-sheet-control-server';

function demonstrateServerSheetControlBatch(control: ServerSheetControl) {
    const book = control.workbook;
    control.batch([
        { method: 'setCell', args: ['B8', 120] },
        { method: 'setCell', args: ['B9', 80] },
        { method: 'setCell', args: ['B10', '=SUM(B8:B9)'] },
    ]);

    console.log(book.sheets.at(0).cell('B10').value);
}

Remarks

Use this member on an object from the current document. Reacquire document-bound handles after replacement/deletion. Validate arguments against the declared types and documented bounds; handle exceptions or rejected promises.

See Also