> ## Documentation Index
> Fetch the complete documentation index at: https://docs.graphy.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Buffer

Parse a binary buffer (XLSX, XLS, or ODS) into the [Data structure](/sdk/core/data-structure) expected by `@graphysdk/core`.

## fromBuffer

```typescript theme={null}
import { fromBuffer } from '@graphysdk/data-import-utils/buffer';

const data = await fromBuffer(xlsxBuffer, 'xlsx');
const data = await fromBuffer(odsBuffer, 'ods', { sheet: 'Revenue' });
```

### Signature

```typescript theme={null}
function fromBuffer(
  input: ArrayBuffer,
  format: 'xlsx' | 'xls' | 'ods',
  options?: SpreadsheetParseOptions
): Promise<Data>
```

## Options

<ParamField path="format" type="BinaryFileFormat" required>
  The binary format: `'xlsx'`, `'xls'`, or `'ods'`.
</ParamField>

<ParamField path="options.sheet" type="string | number" default="0">
  Sheet to parse — name (string) or 0-based index (number).
</ParamField>

<ParamField path="options.locale" type="VizLocale" default="EN_US">
  Locale for number parsing. Determines thousand/decimal separator conventions.
</ParamField>

<ParamField path="options.maxFileSize" type="number" default="5">
  Maximum allowed input size in megabytes.
</ParamField>

<ParamField path="options.maxRows" type="number" default="100000">
  Maximum number of data rows to process.
</ParamField>

<ParamField path="options.maxCells" type="number" default="5000000">
  Maximum total cells to process.
</ParamField>

## Examples

### Parse an uploaded spreadsheet

```typescript theme={null}
import { fromBuffer } from '@graphysdk/data-import-utils/buffer';

const file: File = input.files[0];
const buffer = await file.arrayBuffer();
const data = await fromBuffer(buffer, 'xlsx');
```

### Select a specific sheet

```typescript theme={null}
import { fromBuffer } from '@graphysdk/data-import-utils/buffer';

const data = await fromBuffer(buffer, 'xlsx', { sheet: 'Revenue' });
```
