cancel
Showing results for 
Search instead for 
Did you mean: 

Save cypher-shell or neo4j command-line output to CSV

hbowers
Node Link

I have a query that returns many rows and want to save results in comma- or tab-delimited format for easy ingestion outside neo4j.

Current approach is to feed query to cypher-shell and save output to file:

cat myfile.cql | cypher-shell -u user -p password --format plain > output_file

Query results are not tab- or comma-delimited. How can I make this happen? Is there an alternative approach other than opening the browser, running the query from there, then exporting as CSV?

3 REPLIES 3

brant_boehmann
Node Clone

Consider using the apoc library and its export to csv procedure:
https://neo4j-contrib.github.io/neo4j-apoc-procedures/#export-csv

That looks like the very thing I wanted. Will execute. You are a scholar and a gentleman, Brant, and I think you.

Rory
Node

Updated Link - The documentation has moved and the forwarding does not work quite right - https://neo4j.com/labs/apoc/4.4/overview/apoc.export/apoc.export.csv.query/

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.