Reputation: 1169
I have a .cql query file that I want to run from the Neo4jShell (Windows) with the command:
Neo4j> Neo4jShell -file query.cql
The query returns some rows of data. How can I write that query output into a .csv or .txt file from the shell?
Also, I am using the Windows command prompt so take that into consideration with any solutions. Thanks!
UPDATE 1:
The command suggested by Luane essentially works:
Neo4j> Neo4jShell -file query.cql > out.csv
The only issue is that the output isn't comma separated:
+--------------------------+
| column 1 | column 2 |
+--------------------------+
| "C1611640" | "C1265875" |
| "C1579268" | "C1265875" |
| "C1570906" | "C1265875" |
| "C1522577" | "C1265875" |
| "C1519033" | "C1265875" |
| "C1515119" | "C1265875" |
| . . |
| . . |
| . . |
| "C1533658" | "C1265875" |
| "C1532338" | "C1265875" |
| "C1527144" | "C1265875" |
+--------------------------+
2000 rows
219 ms
Upvotes: 3
Views: 5217
Reputation: 19373
Assuming your query returns data in the format you require, you can just send the output to any file. This works on MacOS, but I don't see why it should not work on Windows:
> neo4j-shell -file query.cql > out.txt
Upvotes: 6