Pavan Kumar Varma
Pavan Kumar Varma

Reputation: 1453

How to import csv data to create nodes with specified properties in neo4j

I have to create 30+ nodes with below CSV data as properties,

  id,name,skill,cur_company,pre_company,college,location

  1,"pavan","java","CGI","CSC","JNTU","HYDERABAD"

  2,"ravi","java","TCS","CSC","SGPL","DELHI"

  ...

How to create nodes by importing above data. like,

u1:User {id:1,name:"pavan",skill:"java",cur_company:"CGI",prev_company:"CSC",location:"HYDERBAD"}

u2:User {id:2,name:"ravi",skill:"java",cur_company:"TCS",prev_company:"CSC",location:"DELHI"}

Upvotes: 2

Views: 847

Answers (2)

shashwat mishra
shashwat mishra

Reputation: 29

Before applying above command , do following changes in neo4j.conf file:

Comment the #dbms.security.allow_csv_import_from_file_urls=true line and uncomment the dbms.directories.import=import line

Upvotes: -1

Michael Hunger
Michael Hunger

Reputation: 41676

There is a dedicated LOAD CSV command in Cypher:

load csv with headers from "file-url" as data
create (u:User {data}}

or

load csv with headers from "file-url" as data
create (u:User {id:data.id, name:data.name, ....}}

Upvotes: 2

Related Questions