I want to import an excel file which is actually a relationship matrix nxn with several relationship types between the n elements.
id| name | element1 | element2 | element3 ... n
1 | element1 1;2;3 1;5
2 | element2 1;2;3
3 | element3 1;5
...
I saved the excel as CSV, which creates a lot of null cells (empty cells).
In Neo4j I tried:
load csv with headers from 'file:///test.csv' as line
WITH line where not line.ID is null
merge (c:element{id: toInteger(line.id),name: line.name})
as a result, I receive no changes and records.
Property names are case-sensitive in Neo4j Cypher.
Your file has column id
but you are checking where not line.ID is null
.
This will skip all the rows as there is no ID
column in your CSV file.
Find below the modified version of your query for readability:
LOAD CSV WITH HEADERS FROM 'file:///test.csv' AS line
WITH line
WHERE line.id IS NOT NULL
MERGE (c:element{id: toInteger(line.id),name: line.name})