Using LOAD CSV with files outside of /var/lib/neo4j/import

Neo4j Version: 5.19.0

I'm using LOAD CSV to import some data in to Neo4j from CSV files.

I'm able to do it when I put the CSV files inside /var/lib/neo4j/import, but I haven't been able to import CSV files when they're outside of this folder.

I've changed the following setting in neo4j.conf:

#server.directories.import=/var/lib/neo4j/import
server.directories.import=/home/user/Desktop

I have also changed this setting:

dbms.security.allow_csv_import_from_file_urls=true

But I keep getting the following error:

Cannot load from URL 'file:///filename.csv': Couldn't load the external resource at: file:///filename.csv

Interestingly, even after changing this setting and doing sudo service neo4j restart, the LOAD CSV command will still seem to only want to pick up CSV files from the /var/lib/neo4j/import folder (even though I've changed the setting).

Where might I be going wrong?

Has the user which started Neo4j read permission at /home/user/Desktop ?

And the file filename.csv is really in that folder?

Anything in debug.log ?

1 Like

Thank you.

I tested a few things and it turns out it was a simple error of me not saving the neo4j.conf file correctly, and the changes were not taking effect.

If anyone runs in to a similar issue, you can check that the settings have changed by running:

tail -f /var/log/neo4j/debug.log | grep server.directories.import

And then restarting Neo4j to see the results.

You should see your desired folder appear in the log, or server.directories.import=/var/lib/neo4j will show up if you have commented out the line (which allows you to access a CSV folder from anywhere on your computer e.g. file:///home/user/Desktop/filename.csv).

1 Like