Load CSV with Column Headers as property and values

(Rcfro2) #1

Is there a way to load a csv with the column headers as the properties of a certain node label and the corresponding values to each row without having to explicitly list it out:

So instead of below:

LOAD CSV WITH HEADERS FROM "some_csv.csv" AS row
CREATE (n:Example)
SET n = row,
n.unitPrice = toFloat(row.unitPrice),

Have something where it implicitly sets the Column headers to the respective row value ?

(Michael Hunger) #2

Not really sure what you're asking for.

In your example the SET n = row sets the properties to the values?

In apoc.load.csv you can provide converters for columns and then set the resulting map directly on a node without individual conversions if that helps.