Somebody asks for the data in a spreadsheet

MongoToFile » Use cases » Export a collection to Excel

Download MongoToFile Free Trial »     Buy MongoToFile Now »

The situation

The person who needs the data - finance, a partner, a colleague on the business side - does not have a MongoDB client and is not going to install one. What they have is a spreadsheet, and what they want is a file that opens in it.

Copying a JSON export into a spreadsheet produces one long column of braces. The data has to arrive already shaped as rows and columns.

What you do

  1. Connect to the MongoDB server and open the collection - or a query, when only some of the documents are wanted.
  2. Choose the output format: Excel for the person who lives in a spreadsheet, CSV/TSV/TXT for a tool that imports it, JSON, XML, HTML or SQL for the rest.
  3. Pick the fields to include and the file name, and give the export a folder.
  4. Run. The file is written locally and nothing is uploaded anywhere.

Choosing the output file and fields when exporting a MongoDB collection in MongoToFile

Since the export is a saved session, "the same report again next month" is one click - or one command from a scheduler, so the file is waiting instead of being remembered.

What it will not do

Related

Documents with sub-fields: nested fields in a flat file. Why not the official utility: MongoToFile or mongoexport. Many collections at once: collections to files, on a schedule. The basic mode: collection to file.