Skip to main content
zerotal

Documentation


Documentation / @zerotal/admin / index / guessColumnMapping

Function: guessColumnMapping()

guessColumnMapping(headers, candidates): Record<number, string>

Defined in: admin/src/actions/csv.ts:106

Pair a CSV's header cells with resource fields.

Matching is forgiving about the ways a label and a key differ in practice — case, spaces, underscores, hyphens — so a file exported from the panel re-imports without the user mapping a single column by hand.

Parameters

headers

string[]

candidates

object[]

Returns

Record<number, string>