cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

APOC.load.csv doesn't ignore empty line

I have a CSV file to read with empty lines at the end:

,,,,,,
,,,,,,

I can only read from this csv and I can't copy it since it's the source and I'm not the one who create it, and it has to be automated without external software.

Is there an 'ignore empty lines' option with apoc.load.csv? I thought it was like that by default but if it was, not anymore with 4.2.5.

Thanks

2 REPLIES 2

dkm1006
Node Clone

Hello Gabriel, I think you can filter the results by adding a WHERE clause after the YIELD in which you test for null values.

(Or rather for empty strings:)

CALL apoc.load.csv("test.csv") 
YIELD map as data, list
WITH data, list
WHERE NOT "" IN list
RETURN data, list

Yeah I did it this way but still apoc.load.csv should remove the empty lines by default as LOAD CSV clause does if I'm right.

It takes more cpu and memory and it's not useful anyway