# importDataFromXlsx

Parses file bytes into a workbook and returns XlsxImportResult. Read the Grid snapshot from the xlsxImported event.

Canonical: https://grid.syidax.com/docs/methods/importDataFromXlsx/

<a id="meaning"></a>

## What does this API do?

Parses file bytes into a workbook and returns XlsxImportResult. Read the Grid snapshot from the xlsxImported event.

<a id="contract"></a>

## Exact input and result types

```typescript
importDataFromXlsx(source: ArrayBuffer | Uint8Array, options?: { sheetName?: string; snapshot?: SheetToRowDataOptions }): Promise<XlsxImportResult>
```

| Arguments | Required | Type |
| --- | --- | --- |
| source | Required | ArrayBuffer \| Uint8Array |
| options | Optional | { sheetName?: string; snapshot?: SheetToRowDataOptions } |

The return type is `Promise<XlsxImportResult>`.

<a id="usage"></a>

## Usage flow

After registering and initializing the Grid element, call grid.importDataFromXlsx(…). Read the return value with await. For methods returning a boolean or report, inspect the result before continuing.

<a id="types"></a>

## Read related types

- [SheetToRowDataOptions](https://grid.syidax.com/docs/types/SheetToRowDataOptions.md)
- [XlsxImportResult](https://grid.syidax.com/docs/types/XlsxImportResult.md)

<a id="recipes"></a>

## Feature explanations and examples

- [Excel import](https://grid.syidax.com/docs/features/xlsx-import.md) — XLSX import reads a workbook and converts the selected sheet into a Grid column-and-row snapshot. The full parsed workbook and the display snapshot are different data.
