Export CSV from Firebase Firestore

Export CSV from Firebase Firestore

With Firefoo you can export collections to CSV with just a few clicks so that you can get your data into Airtable, Google Sheets or Excel.

How to Export Firestore Collections as CSV

1
Download and install Firefoo
2
If prompted, sign in with Google
3
Right-click the collection in the sidebar and select Export Collection
default
4
Make sure the CSV Format is selected and click the Export button
default
5
Select the file destination in the file chooser.
6
That’s it!
Your collection is exported to CSV and a progress popup opens. If you close that popup, the export will still continue to run in the background. Get back to the progress popup again through FileTasks.

Order and Limit

Select the Limit docs per Collection option to limit the total number of rows to export. If unselected, Firefoo is able to export millions of documents. Rows are not sorted by the date they were created or last modified. Instead, they are ordered by their document ID, which is usually random-generated. To export in another order, read on about how to export the result of a query.

Export Firestore Query Results to CSV

You can export the results of a specific query with where and order-by clauses to CSV.
1
Click the collection in the sidebar on the left
2
Add Where conditions and Order by clauses. Adjust the number of documents with the Limit field, click the Run button to run your query!
3
Click the Export Results icon as seen in the screenshot below
default

☑️ Include Document IDs

If selected, Firefoo will add a column named __id__ to the exported CSV file, which contains the document ID. When documents of the collections do not have custom doc-IDs, this column will show the default auto-generated 20-character IDs of the document.

☑️ Include Resource Paths

If selected, Firefoo will add a column named __path__ to the exported CSV file, which contains the full document path. Examples are users/dan orcities/Berlin/events/party123.

☑️ Custom Output Format ⚙️️

This option specifies how timestamps and numbers are formatted in your export. When unselected, timestamps are formatted in the ISO 8601 date format, e.g.2021–11–23T23:13:52.000Z. This should be your preferred option if you plan to import the CSV into another app or service, as it is widely supported.

Maps

If your Firestore documents contain Map fields (objects), Firefoo can either split them into multiple columns or serialize them to JSON.
Let’s say every document in a collection has an address field with two nested fields city and street, e.g.
address: { city: "San Francisco", street: "Market Street" }
  1. Split Maps into Columns: Firefoo will create two columns: address.city andaddress.street. This is more human-readable and should be preferred if the data is meant to be looked at by humans. Be aware though: if your data contains Maps with dynamic field names, the number of CSV columns can become very large!
  2. Export Maps as JSON: Serialize Map columns to JSON. In the example above, the exported value is{city: "San Francisco", street: "Market Street" }. This also works with nested Map fields.
  3. As in Table View: This option is only available when exporting the results of a query! It will serialize Map fields to JSON, unless they were split into multiple columns in the Table view. Only the split-columns are exported as separate CSV columns, so that the resulting CSV table looks just like the Table view in Firefoo.

Export Subcollections to CSV

If you want to export a single subcollection to CSV, instead of one of the root-level collections, that’s also possible! Subcollections are not shown in the sidebar. That’s why you have to locate the subcollection in the Tree view (not the Table view) and open the right-click context menu from there. Choose Export and the same export dialog as above appears.

Format

  • String: The content of the string
  • Boolean: true or false
  • Null: null
  • Map: {"field1": "value1", "field2": 42, "field3": false}
  • Array: ["hello", true, 42]
  • Geopoint: Latitude and longitude are exported into two columns, e.g. a location field in Firestore will become onelocation.__lat__ and onelocation.__lon__ column in the CSV file.
  • Timestamp: Defaults to ISO 8601 format: 2021–11–23T13:11:52.000Z. Can be customized with️ ☑️ ️️️Custom Output Format option.
  • Document Reference: Full path to the document without leading slash, e.g. myCollection/myDocId or myCollection/myDocId/mySubcollection/myNestedDocId
  • Integer: Defaults to the full integer without any thousands delimiter, e.g.12345678. Can be customized with️ ☑️ ️️️Custom Output Format option.
  • Double: Defaults to the full unrounded double, without any thousands delimiter, e.g. 12345.987654. Special values Infinity, -Infinity and NaNare supported. Can be customized with️ ☑️ ️️️Custom Output Format option.

FAQ

How many requests will this take away from my quota?

Firefoo uses one read request for every document that is exported into the CSV.

How to import the JSON Collections into Firestore?

Right-click on the target database in the sidebar and select Import Collections. In the Import Dialog, choose the CSV file and specify the target collection name in the Target Path field.