Knowledge Base

How to import a file with LOAD CSV that has a space in file name?

When you try to import data from a file using LOAD CSV where the filename containing spaces for example you get the following error:

Statement:

load csv from "file:///test copy.csv" as row return row

Error:

java.net.URISyntaxException: Illegal character in path at index 10: file:/test copy.csv

To allow for a space in the filename, simply replace the space in the LOAD CSV command with %20 (url encoding)

load csv from "file:///test%20copy.csv" as row return row

Similarly, if you have any other characters (such as #) in the filename, simply replace that charater with the appropriate ASCII url encoding (for # it happens to be %23).

An ASCII encoding reference can be found here: