cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Load CSV doesn't work

Michel
Node Clone

Hi,

I need your help: the code doesn't  create any relationships:

LOAD CSV WITH HEADERS FROM("file:///test.csv") AS row
MATCH (p1:City {DS:row.from}), (p2:City {DS:row.to})
CREATE (p1)-[:NB]->(p2);

The nodes:

CREATE (a:City {DS: 'AAA'})
CREATE (b:City {DS: 'BBB'})
CREATE (c:City {DS: 'CCC'})
CREATE (d:City {DS: 'DDD'})

The csv file

test.csv

from, to
"AAA","BBB"
"CCC","DDD"

Thanks a lot in advance,

 

Michel

 

1 ACCEPTED SOLUTION

ameyasoft
Graph Maven

Check the csv header. There is a space before 'to'. 

View solution in original post

3 REPLIES 3

ameyasoft
Graph Maven

Looks like csv header column has a space before 'to'.  You can remove the space before 'to' or use backtick. 

MATCH (p1:City {DS:row.from}), (p2:City {DS:row.``  to`  `})
CREATE (p1)-[:NB]->(p2)
Above Cypher created the relationships.

ameyasoft
Graph Maven

Check the csv header. There is a space before 'to'. 

Michel
Node Clone

You saved my day ....