# importCsvText

Parses CSV text and replaces columns and source data. For appending rows, parse separately and use transactions.

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

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

## What does this API do?

Parses CSV text and replaces columns and source data. For appending rows, parse separately and use transactions.

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

## Exact input and result types

```typescript
importCsvText(text: string, options?: { delimiter?: CsvDelimiter; hasHeader?: boolean }): Promise<{ rowCount: number; columnCount: number }>
```

| Arguments | Required | Type |
| --- | --- | --- |
| text | Required | string |
| options | Optional | { delimiter?: CsvDelimiter; hasHeader?: boolean } |

The return type is `Promise<{ rowCount: number; columnCount: number }>`.

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

## Usage flow

After registering and initializing the Grid element, call grid.importCsvText(…). 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

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

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

## Feature explanations and examples

- [Import CSV](https://grid.syidax.com/docs/features/csv-import.md) — CSV import converts delimited text into new columns and rows. Unlike a transaction that appends rows, importCsvText replaces columnDefs and rowData.
