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

# Quickstart

`@graphysdk/data-import-utils` converts CSV, TSV, and spreadsheet files into the [Data structure](/sdk/core/data-structure) expected by `@graphysdk/core`.

## Installation

<CodeGroup>
  ```bash npm theme={null}
  npm install @graphysdk/data-import-utils @graphysdk/core
  ```

  ```bash yarn theme={null}
  yarn add @graphysdk/data-import-utils @graphysdk/core
  ```

  ```bash pnpm theme={null}
  pnpm add @graphysdk/data-import-utils @graphysdk/core
  ```
</CodeGroup>

## Parse a CSV

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

const data = fromCSV('Name,Revenue\nAcme,1000\nGlobex,2000');
// { columns: [{ key: 'c1', label: 'Name' }, ...], rows: [...] }
```

## Parse a Spreadsheet

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

const buffer = await file.arrayBuffer();
const data = await fromXLSX(buffer, { sheet: 'Revenue' });
```

## Parse from Disk (Node.js)

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

const data = await fromFile('sales.csv');
```

`fromFile` auto-detects the format from the file extension. See [File](/data-import-utils/file) for details.

## Parse from URL

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

const data = await fromURL('https://example.com/sales.csv');
```

`fromURL` fetches a remote file and auto-detects the format from the URL path extension. See [URL](/data-import-utils/url) for details.

## Features

| Feature                 | Details                                                                                            |
| ----------------------- | -------------------------------------------------------------------------------------------------- |
| Formats                 | CSV, TSV, XLSX, XLS, ODS                                                                           |
| SSRF protection         | `fromURL` blocks private IPs and non-http(s) schemes                                               |
| Timeout support         | `fromURL` supports configurable timeout and `AbortSignal`                                          |
| Byte-budget enforcement | All parsers enforce a configurable `maxFileSize` limit; `fromURL` aborts streaming downloads early |
| Row / cell limits       | Spreadsheet parsers enforce `maxRows` (default 100k) and `maxCells` (default 5M)                   |

## Entrypoints

### Sources

| Source                | Function       | Entrypoint                            |
| --------------------- | -------------- | ------------------------------------- |
| Local file            | `fromFile()`   | `@graphysdk/data-import-utils/file`   |
| Remote URL            | `fromURL()`    | `@graphysdk/data-import-utils/url`    |
| Text (CSV/TSV)        | `fromText()`   | `@graphysdk/data-import-utils/text`   |
| Binary (XLSX/XLS/ODS) | `fromBuffer()` | `@graphysdk/data-import-utils/buffer` |

### Formats

| Format | Function     | Input type    | Entrypoint                                      |
| ------ | ------------ | ------------- | ----------------------------------------------- |
| CSV    | `fromCSV()`  | `string`      | `@graphysdk/data-import-utils` (root) or `/csv` |
| TSV    | `fromTSV()`  | `string`      | `@graphysdk/data-import-utils` (root) or `/tsv` |
| XLSX   | `fromXLSX()` | `ArrayBuffer` | `@graphysdk/data-import-utils/xlsx`             |
| XLS    | `fromXLS()`  | `ArrayBuffer` | `@graphysdk/data-import-utils/xls`              |
| ODS    | `fromODS()`  | `ArrayBuffer` | `@graphysdk/data-import-utils/ods`              |
