Aman Kumar
Aman Kumar

Reputation: 137

Importing CSV file in Neo4j

While using this command LOAD CSV FROM "file:///artists.csv" AS line CREATE (:Artist { name: line.Name, year: toInt(line.Year)})

I am getting Error: Type mismatch: expected Any, Map, Node or Relationship but was List<String> (line 2, column 25 (offset: 68)) "CREATE (:Artist { name: line.Name, year: toInt(line.Year)})"

CSV file "1","ABBA","1992" "2","Roxette","1986" "3","Europe","1979" "4","The Cardigans","1992"

Upvotes: 2

Views: 969

Answers (2)

konstantin shevchenko
konstantin shevchenko

Reputation: 61

Please try

LOAD CSV WITH HEADERS FROM "file:///artists.csv" AS line CREATE (:Artist { name: line.Name, year: toInt(line.Year)})

Make sure you have Name and Year columns in the atists.csv file

Upvotes: 3

logisima
logisima

Reputation: 7458

Your CSV has no header, so you can't access a column by its name, ie when you do this : line.Name.

You have to do it by the column index : line[0]

Cheers

Upvotes: 3

Related Questions