2
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

Rajendra Kadam
  • 4,004
  • 1
  • 10
  • 24

2 Answers2

3

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.

Rajendra Kadam
  • 4,004
  • 1
  • 10
  • 24
0

try below line, use some extra slashes

LOAD CSV FROM "file:///C:/Users/abcd/Desktop/Neo4J/fileName.csv" AS row
WITH row
RETURN row
Govind Singh
  • 15,282
  • 14
  • 72
  • 106