Aarti Shelukar
Aarti Shelukar

Reputation: 60

Neo4j LOAD CSV Error: unknown protocol: c

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

Upvotes: 2

Views: 3114

Answers (2)

Rajendra Kadam
Rajendra Kadam

Reputation: 4052

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.

Upvotes: 3

Govind Singh
Govind Singh

Reputation: 15490

try below line, use some extra slashes

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

Upvotes: 0

Related Questions