[**Documentation**](../../../../README)

***

[Documentation](../../../../README) / [@zerotal/admin](../../README) / [index](../README) / importCsv

# Function: importCsv()

> **importCsv**(`resource`, `csv`, `mapping?`, `options?`): `Promise`\<[`ImportResult`](../interfaces/ImportResult)\>

Defined in: [admin/src/actions/transfer.ts:130](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/admin/src/actions/transfer.ts#L130)

Turn CSV text into records on `resource`.

Every row is validated through the resource's own form fields, so an import
cannot write anything a human couldn't have typed into the create form. A row
that fails is reported and skipped — one bad line out of five hundred should
not discard the other four hundred and ninety-nine.

## Parameters

### resource

*typeof* [`Resource`](../classes/Resource)

### csv

`string`

### mapping?

`Record`\<`number`, `string`\>

Column index → field key. Omit to infer from the header row.

### options?

`limit` overrides the row cap — a queued import has no request to hold open.

#### limit?

`number`

## Returns

`Promise`\<[`ImportResult`](../interfaces/ImportResult)\>
