Neo4j Importing local CSV File

You need to put the filename in quotes, and add a few more slashes:

LOAD CSV WITH HEADERS FROM "file:///C:/csv/user.csv"

Full documentation here.


The command below will return the first 5 lines of your CSV file:

LOAD CSV WITH HEADERS FROM "file:///<PATH_TO_YOUR_CSV_FILE>" AS line WITH line RETURN line LIMIT 5;

But you'll have to follow some steps to align with Neo4J security restrictions.

1) Find the conf folder in the neo4j server folder. Open the neo4j.conf with a text editor.

2) Uncomment the line containing:

#dbms.security.allow_csv_import_from_file_urls=true

To uncomment it, just remove #. It should be like this:

dbms.security.allow_csv_import_from_file_urls=true

3) Comment this line below:

dbms.directories.import=import

To comment it, add #. It should be like this:

#dbms.directories.import=import

Further on importing from CSV in neo4j documentation here: https://neo4j.com/blog/importing-data-neo4j-via-csv/


LOAD CSV WITH HEADERS FROM "file:C:/path/location/filename.csv" AS row

Found that these query asks Neo4j to look in a specific location C:\Users\*******\.Neo4jDesktop\neo4jDatabases\database-2b9d81ff-1976-427e-ba98-4f3191c3ef62\installation-3.4.9\import

placing your csv here and using the query

LOAD CSV WITH HEADERS FROM "file:///testData2.csv" AS line

solved the issue for me

or you can change the settings by making changes here

dbms.directories.import=import

NB: I am using windows 10 , neo4j-desktop-offline-1.1.12

Tags:

Neo4J

Cypher