# External querying and export

**URL:** <https://community.neo4j.com/t/external-querying-and-export/4882>\
**Category:** Import / Export\
**Created:** [February 6, 2019, 7:11am UTC](https://community.neo4j.com/t/external-querying-and-export/4882 "2019-02-06T07:11:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pivotpab](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/pivotpab/32/3171_2.png) [@pivotpab](https://community.neo4j.com/u/pivotpab)\
**Post date:** [February 6, 2019, 7:11am UTC](https://community.neo4j.com/t/external-querying-and-export/4882/1 "2019-02-06T07:11:51Z")

</div>

Hi All,

I really apologise if I'm writing this all wrong as it's my first post and I'm new to neo4j.

I simply want to find an external tool that I can connect to neo4j dB with to query the json.

Ideally I'm looking for a way to automate the export of a csv file via a tool each morning... That will query the DB, and return the results as a table within the csv file.

I'm. Sorry if I've not provodes enough info. Please do let me know.

Any help is appreciated

---

<div class="post-metadata">

**Author:** ![michael.hunger](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/michael.hunger/32/27377_2.png) [@michael.hunger](https://community.neo4j.com/u/michael.hunger)\
**Post date:** [February 6, 2019, 5:29pm UTC](https://community.neo4j.com/t/external-querying-and-export/4882/2 "2019-02-06T17:29:58Z")

</div>

Not 100% sure what you need, like a cron job?

You could use cypher-shell with a cypher query to gather your data.

`cat data-export.cypher | bin/cypher-shell -u username -p password`

---

<div class="post-metadata">

**Author:** ![pivotpab](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/pivotpab/32/3171_2.png) [@pivotpab](https://community.neo4j.com/u/pivotpab)\
**Post date:** [February 7, 2019, 4:01pm UTC](https://community.neo4j.com/t/external-querying-and-export/4882/3 "2019-02-07T16:01:58Z")

</div>

Thanks for replying Michael. This is interesting.

So basically I want to query Neo4j using Match and Return. A scenario would be to have a batch file execute a tool (perhaps Cypher shell) that has the query stored that will run against Neo4j and export the results to file (e.g. CSV)

I guess then the batch could add the file to a specific folder. Would Cypher shell query and export from a local machine (with the right perms)?

Thanks

---

<div class="post-metadata">

**Author:** ![michael.hunger](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/michael.hunger/32/27377_2.png) [@michael.hunger](https://community.neo4j.com/u/michael.hunger)\
**Post date:** [February 7, 2019, 9:50pm UTC](https://community.neo4j.com/t/external-querying-and-export/4882/4 "2019-02-07T21:50:04Z")

</div>

Cypher shell runs on the machine you run it on.  
It can connect to remote neo4j servers.

You can redirect the output to a file (which might have a date suffix)  
And the statements to run can come from a file too

For details on how to do this on your system I recommend to talk to your ops/devops/admin folks.
