I am using Neo4j on my browser on Ubuntu. I got over 1 million nodes and I want to export them as csv file.
When return data size is small like "match n return n limit 3" there is a big fat "download csv" button I could use. But when it comes to big result set like over 1000 the shell just says "Resultset too large(over 1000 rows)" and the button doesnt show up.
How can I export csv files for large resultset?
You can already export CSV from the Neo4j Browser by clicking the download icon on the table view of your Cypher query results. Alternatively, you can also use my neo4j-shell-tools to export results of a Cypher query to a CSV file.
On recent versions of Neo4j, you can export CSV, SVG or PNG directly from the console - button on top right in attached image.
Neo4j stores a few default favorites to get you started. Just click on the Basic Queries, then choose Get Some Data and run the query. This executes the statement MATCH (n) RETURN n limit 100 , which fetches some nodes. You can save your own queries as favorites by "starring" them.
You can also use my shell extensions to export cypher results to CSV.
See here: https://github.com/jexp/neo4j-shell-tools#cypher-import
Just provide an -o output.csv file to the import-cypher
command.
Well, I just used linux shell to do all the job.
neo4j-shell -file query.cql | sed 's/|/;/g' > myfile.csv
In my case, I had also to convert from UTF-8 to ISO-8859-1 so I typed:
neo4j-shell -file query.cql | sed 's/|/;/g' | iconv -f UTF-8 -t ISO-8859-1 -o myfile.csv
PS: sed performs the replace: 's/|/;/g' means, substitute (s) all "|" to ";" even though there is more than one per line (g)
Hope this can help.
Regards
We followed the approach below using mentioned. It works very well for us. data is formatted properly in csv format.
https://github.com/jexp/neo4j-shell-tools#cypher-import
import-cypher command from neo4J shell.
neo4j-sh (?)$ import-cypher -o test.csv MATCH (m:TDSP) return m.name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With