# Sheet

**Kind**: interface | **Module**: [Excel](https://docs.interop.io/adapters/reference/javascript/excel/index.md)

**Source**: https://docs.interop.io/adapters/reference/javascript/excel/sheet/index.html

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

## Properties

- **`columnConfig`** (`ColumnConfig[]`, required)
  Current column configuration.
- **`data`** (`object[]`, required)
  The current data in the sheet.
- **`name`** (`string`, required)
  The name of the sheet.
- **`options`** (`OpenSheetOptions`, optional)
  Sheet options.
- **`workbook`** (`string`, optional)
  The name of the workbook.

## Methods

### changeColumnConfig

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

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

**Parameters**

- **`columnConfig`** (`ColumnConfig[]`, required)
  The new column configuration.
- **`data`** (`object[]`, optional)
  Optional new data to set.

**Returns**: `Promise<void>`

### onChanged

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

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

**Parameters**

- **`callback`** (`(data: object[], errorCallback: (errors: ValidationError[]) => void, doneCallback: () => void, delta: DeltaItem[]) => Promise<void>`, required)
  Callback invoked with the data, error callback, done callback, and delta.

**Returns**: `UnsubscribeFunction`

**Example**

```ts
```javascript
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

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

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

**Parameters**

- **`callback`** (`(info: SheetChangingInfo) => void`, required)
  Callback invoked with chunk progress info.

**Returns**: `UnsubscribeFunction`

### update

Updates the data in the sheet.

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

**Parameters**

- **`data`** (`object[]`, required)
  The new data to set.

**Returns**: `Promise<void>`

## Related types

- [ColumnConfig](https://docs.interop.io/adapters/reference/javascript/excel/columnconfig/index.md)
- [DeltaItem](https://docs.interop.io/adapters/reference/javascript/excel/deltaitem/index.md)
- [OpenSheetOptions](https://docs.interop.io/adapters/reference/javascript/excel/opensheetoptions/index.md)
- [SheetChangingInfo](https://docs.interop.io/adapters/reference/javascript/excel/sheetchanginginfo/index.md)
- [ValidationError](https://docs.interop.io/adapters/reference/javascript/excel/validationerror/index.md)
