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.

Export relation to CSV

Hello everyone again!

I want to export one relation that I have created to a csv file (unfortunatelly everyone at my office is more familiar to Excel than to Neo4j).

I have already added to my neo4j.conf file the cod:
apoc.export.file.enabled=true

I also know how to export, and that the export.csv file is located in the import folder (this took me some time ).

The point is that I have only been able to export the whole table, not my relationship defined.

This is my relationship:
MATCH (d:asia)<-[:son]-(p:person)
WITH p, count(d) as brothers
WHERE numResidents >=2
MATCH (d:asia)<-[:son]-(p:person)
RETURN d, p

But I do not know where to put it in the clause:
CALL apoc.export.csv.all("familyInfo.csv", {})

Any help will be more than welcome!!!!!

1 ACCEPTED SOLUTION

Hello!

Did you know that you can export to CSV from Neo4j Browser?

If you want to use apoc, you simply need to change from apoc.export.csv.all to apoc.export.csv.query. Your command would look like this.

CALL apoc.export.csv.query("
MATCH (d:asia)<-[:son]-(p:person)
WITH p, count(d) as brothers
WHERE numResidents >=2
MATCH (d:asia)<-[:son]-(p:person)
RETURN d, p", "familyInfo.csv", {})

View solution in original post

3 REPLIES 3

Hello!

Did you know that you can export to CSV from Neo4j Browser?

If you want to use apoc, you simply need to change from apoc.export.csv.all to apoc.export.csv.query. Your command would look like this.

CALL apoc.export.csv.query("
MATCH (d:asia)<-[:son]-(p:person)
WITH p, count(d) as brothers
WHERE numResidents >=2
MATCH (d:asia)<-[:son]-(p:person)
RETURN d, p", "familyInfo.csv", {})

Thanks Nathan!!!!

I knew about the download option, not about the apoc.export.csv.query. With this works perfect.

Thanks!!

Hi @nsmith_piano ! Can I use " apoc.export.csv.query" for "apoc.export.csv.data" too for this issue: Memory issues using apoc.export.csv.data I am running from the browser too.

Thanks!