Adding properties to relationship while load data using LOAD CSV option

How to add properties to relationship while load data using LOAD CSV option?

Hi, you should have a csv with relationships and properties.

https://neo4j.com/docs/getting-started/current/cypher-intro/load-csv/

1 Like

If you use the test.csv from apoc.load.csv docs:

name,age,beverage
Selma,9,Soda
Rana,12,Tea;Milk
Selina,19,Cola

Load age into a relationship between person and beverage:

CALL apoc.load.csv('test.csv')
YIELD lineNo, map
MERGE (p:Person {name: map.name})
MERGE (b:Beverage {name: map.beverage})
MERGE (p)<-[:DRANK_BY {age: map.age}]-(b)
1 Like

Thanks iggomez for the source..

Thanks tony.. it helped