Try Studio 3T for Free
  1. Knowledge Base
  2. Import/Export
  3. Copy MongoDB Query Results to CSV, Excel & Google Sheets

Copy MongoDB Query Results to CSV, Excel & Google Sheets

Here’s the fastest way to copy query results from MongoDB to CSV, Excel – even Google Sheets.

Please note that this functionality fully supports pasting in Microsoft Excel, but might not work with other third-party spreadsheet software.

1. Run a query in Studio 3T.  I’ve used the Visual Query Builder below, but you can also write queries in IntelliShell, Aggregation Editor or SQL Query.

A query built using Visual Query Builder
I’ve built the query in the Query section so that my results only contain customers who (1) live in Chicago, (2) have opted for priority support, and (3) have ordered more than 50 times.

I’ve also applied a projection and sort in the Projection and Sort sections to clean up a bit, as this is how I’d like to paste the data in Google Sheets.

2. Choose Table View in the drop-down.

Choose Table View in the dropdown menu

3. Right-click on the query results you want to copy from MongoDB to CSV or Excel. Choose whether to include the headers or not.

Choose CSV or Excel, with or without the headers

If you’re exporting MongoDB query results to Google Sheets, choose Copy Selected Documents for Excel.

4. Paste the results directly in Excel or Google Sheets, or as CSV.

Export MongoDB to Excel or Google Sheets

And there you have it: the quickest way to export MongoDB query results to Excel, Google Sheets, and CSV.

Download Studio 3T for free to try it out for yourself, along with these other handy copy-paste features:

Updated on March 23, 2021

Was this article helpful?

Related Articles

Leave a Comment