Skip to main content

Represents an Excel worksheet opened or tracked by the Excel Adapter.

Properties (5)

Property Type Default Required Description
columnConfig⚓︎ ColumnConfig[] x

Current column configuration.

data⚓︎ object[] x

The current data in the sheet.

name⚓︎ string x

The name of the sheet.

options⚓︎ OpenSheetOptions x x

Sheet options.

workbook⚓︎ string x x

The name of the workbook.

4 Methods

changeColumnConfig()⚓︎

(columnConfig: ColumnConfig[], data?: object[]) => Promise<void>

Change the column configuration of the sheet. Optionally pass new data (if not passed it will keep the existing data).

Parameters (2)

Name Type Required Description
columnConfig⚓︎ ColumnConfig[]

The new column configuration.

data⚓︎ object[] x

Optional new data to set.

onChanged()⚓︎

(callback: (data: object[], errorCallback: (errors: ValidationError[]) => void, doneCallback: () => void, delta: DeltaItem[]) => Promise<void>) => UnsubscribeFunction

Executes when the sheet is changed in Excel, after all chunks have arrived.

Parameters (1)

Name Type Required Description
callback⚓︎ (data: object[], errorCallback: (errors: ValidationError[]) => void, doneCallback: () => void, delta: DeltaItem[]) => Promise<void>

Callback invoked with the data, error callback, done callback, and delta.

Example

const sheet = await office.excel.openSheet(options);

sheet.onChanged(async (data, errorCb, doneCb, delta) => {
    console.log(data);
    // If no errors - call doneCb().
    // Otherwise call errorCb([{ row: 0, column: 1, description: "Error!" }]).
});

onChanging()⚓︎

(callback: (info: SheetChangingInfo) => void) => UnsubscribeFunction

Executes when data starts coming in from Excel, once for every chunk. Useful for showing progress indication, etc.

Parameters (1)

Name Type Required Description
callback⚓︎ (info: SheetChangingInfo) => void

Callback invoked with chunk progress info.

update()⚓︎

(data: object[]) => Promise<void>

Updates the data in the sheet.

Parameters (1)

Name Type Required Description
data⚓︎ object[]

The new data to set.