0
votes

I am importing csv file from import directory by cypher and I would like to create nodes with labels from csv file. Which would look something like this

LOAD CSV WITH HEADERS FROM "file:///B.csv" AS csv
CREATE (c:csv.Type {name:csv.Name})
return c 

I know that this is wrong, but hope you can show me the right way to do it. I couldn't find any answer in both neo4j community and in stackoverflow.

1

1 Answers

0
votes

from neo4j community dana.canzano's answer. It could be implemented by apoc library. Here is the code.

load csv with headers from 'file:///B.csv' as row 
call apoc.create.node([row.label],{name: row.name}) 
yield node return count(node);

You can find more details in community page