> ## 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.

# XLS

Parse XLS spreadsheet files into the [Data structure](/sdk/core/data-structure) expected by `@graphysdk/core`.

## fromXLS

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

const buffer = await file.arrayBuffer();
const data = await fromXLS(buffer);
```

### Signature

```typescript theme={null}
function fromXLS(
  input: ArrayBuffer,
  options?: SpreadsheetParseOptions
): Promise<Data>
```

## Options

<ParamField path="sheet" type="string | number" default="0">
  Sheet to parse. Pass a sheet name (`string`) or a 0-based index (`number`).
  Defaults to the first sheet.
</ParamField>

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

<ParamField path="maxFileSize" type="number" default="5">
  Maximum allowed input size in megabytes. Throws an error if the input exceeds this limit.
</ParamField>

<ParamField path="maxRows" type="number" default="100000">
  Maximum number of data rows to process. Throws an error if the sheet contains more rows.
</ParamField>

<ParamField path="maxCells" type="number" default="5000000">
  Maximum total cells (rows x columns) to process. Throws an error if the limit is exceeded.
</ParamField>

## Examples

### Select Sheet by Name

```typescript theme={null}
const data = await fromXLS(buffer, { sheet: 'Revenue' });
```

## Cell Value Handling

| Cell type | Result          |
| --------- | --------------- |
| Number    | `number`        |
| String    | `string`        |
| Boolean   | `1` or `0`      |
| Date      | ISO 8601 string |
| Formula   | Computed result |
| Rich text | Plain text      |
| Empty     | `null`          |

<Warning>
  `fromXLS` uses the same XLSX-based parser under the hood. It works with
  modern `.xls` files that are actually in XLSX format (common in Excel 2007+).
  Genuine legacy binary XLS (BIFF) format is not supported.
</Warning>
