1
votes

I am unable to successfully import a csv file in the neo4j browser, as the nodes are created but they do not show the properties. Does anyone see the problem? I will describe how I proceeded:

This is how the csv file looks

enter image description here

I have tested the csv file with LOAD CSV WITH HEADERS FROM "file:///testCSV3.csv" AS line WITH line LIMIT 4 RETURN line

and the result is ok (I guess?):

enter image description here

I then tried various things, as e.g. this query:

LOAD CSV WITH HEADERS FROM "file:///testCSV3.csv" AS line CREATE (:Activity {activityName: line.MyActivity, time: toInteger(line.Timestamp)})

The outcome is nodes without properties:

enter image description here

Any ideas what I am missing? Why are the properties activityName and time not showing up? - Thanks in advance!

1
In the CSV file, are the fields separated by a comma (",")?rickhg12hs
Thanks, please see my comment below.CodeIsland

1 Answers

3
votes

(You should have shown your raw CSV file, to make the problem clearer.)

I assume your raw file starts out like this:

ID ;Timestamp;MyActivity
1;1;Run
2;2;Talk
3;3;Eat

LOAD CSV is sensitive to extra spaces, so your ID header should not be followed by a space. Also, the default field terminator is a comma not a semicolon, so you need to specify the FIELDTERMINATOR option to override the default.

Your results would be more reasonable if you removed the extra space and changed your query to this:

LOAD CSV WITH HEADERS FROM "file:///testCSV3.csv" AS line FIELDTERMINATOR ';'
WITH line LIMIT 4
RETURN line