1
votes
LOAD CSV FROM "file:/C:/Users/abcd/Desktop/Neo4J/fileName.csv" AS row
WITH row
RETURN row

This is my code for importing this csv to my database but it is giving me error as

Neo.ClientError.Statement.ExternalResourceFailed: Invalid URL 'C:/Users/abcd/Desktop/Neo4J/fileName.csv': unknown protocol: c

can anyone help me solve this

2

2 Answers

2
votes

Local CSV files are accessible using file:/// URL.

file:/// URLs identify files on the filesystem of the database server

You need to add file as protocol before the local files address, as follows:

LOAD CSV FROM "file:///C:/Users/abcd/Desktop/Neo4J/fileName.csv" AS row
WITH row
RETURN row

NOTE:

You need to change neo4j.conf file for allowing CSV import from file URLs.

Uncomment this line(remove #):

#dbms.security.allow_csv_import_from_file_urls=true

Comment this line(Add # in the start):

dbms.directories.import=import

Don't forget to restart Neo4j after these changes.

0
votes

try below line, use some extra slashes

LOAD CSV FROM "file:///C:/Users/abcd/Desktop/Neo4J/fileName.csv" AS row
WITH row
RETURN row