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

# CSV

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

## fromCSV

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

const data = fromCSV('Name,Revenue\nAcme,1000\nGlobex,2000');
const data = fromCSV('Name;Revenue\nAcme;1000\nGlobex;2000'); // semicolon-delimited
```

### Signature

```typescript theme={null}
function fromCSV(input: string, options?: DelimitedParseOptions): Data
```

## Options

<ParamField path="hasHeader" type="boolean" default="true">
  Whether the first row contains column headers. When `false`, columns are
  auto-named `Column 1`, `Column 2`, etc.
</ParamField>

<ParamField path="locale" type="VizLocale" default="EN_US">
  Locale for number parsing. Determines thousand/decimal separator conventions.
  For example, `'PT_PT'` treats `1.000,50` as `1000.5`.
</ParamField>

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

## Examples

### Without Headers

```typescript theme={null}
const data = fromCSV('Acme,1000\nGlobex,2000', { hasHeader: false });
// Columns auto-named: "Column 1", "Column 2"
```

### European Number Format (semicolon-delimited)

```typescript theme={null}
const csv = `Produto;Receita
Widgets;1.234,56
Gadgets;7.890,12`;

const data = fromCSV(csv, { locale: 'PT_PT' });
// Receita values parsed as 1234.56 and 7890.12
```

<Note>
  The CSV delimiter is auto-detected (comma, semicolon, pipe, etc.). For
  tab-separated data, you can also use [`fromTSV`](/data-import-utils/tsv).
</Note>
