Skip to main content
zerotal

Documentation


Documentation / @zerotal/admin / index / importCsv

Function: importCsv()

importCsv(resource, csv, mapping?, options?): Promise<ImportResult>

Defined in: admin/src/actions/transfer.ts:130

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

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>