Firebase Cloud Firestore

The Firebase Cloud Firestore connector gets your Firestore data into Google Sheets and Google Data Studio. Use it to track your key metrics in a spreadsheet or a Google Data Studio report.
What you can report on
- Custom Firestore collection data
- App event counts and user activity
- Document-level metrics and fields
- In-app purchase and subscription data
- Custom business metrics stored in Firestore
Prerequisites
- A Firebase project with Cloud Firestore enabled
- A service account with the Cloud Datastore User role
- The service account JSON key file downloaded from Firebase Console
How to get your credentials
allow read: if true: that rule lets anyone on the internet read your database.Generate a service account key
- In the Firebase Console, go to Project Settings (gear icon).
- Select the Service Accounts tab.

- Select Generate New Private Key.

- Your browser downloads a
.jsonfile. Keep this file secure. You paste its contents into Two Minute Reports.

How to create a connection
- In the Hub, open Connections & accounts.
- Select Create connection.
- Select Firebase - Cloud Firestore in the connector list.
- Select Next.

- In Name the connection, enter a name.
- In Service account credentials (JSON), paste the full contents of your service account
.jsonkey file. If you don't have the file yet, see How to get your credentials. - Select Test connection.


- Enable the database you want to report on.
- Select Done.

How to get Firebase Cloud Firestore data into Google Sheets or Google Data Studio
To get Firebase Cloud Firestore data into Google Sheets:
- In the Two Minute Reports sidebar, open Data Queries.
- Select Add.
- Select the database you want to report on. A query uses one database.
- Under Query Type, select Structured Query or FireSQL. Then enter your Query.
- Select Run query. Two Minute Reports adds the data to your sheet.


To get Firebase Cloud Firestore data into Google Data Studio:
- In the Hub, open Google Data Studio › Firebase - Cloud Firestore.
- Select Create report.

- Select or create a query config:
- To use a query config you have: select it in Choose your query config. Then select Save.
- To create a query config: if you already have one, first select Create new query config in the list. Enter a name in Name your query config, and select the database in Select your account. Under Query type, select Structured query or FireSQL, and enter your Query. Select Save.


- Select Create from scratch. If templates show under Quick start from a template, you can select one instead.

- Looker Studio (formerly Google Data Studio) opens in a new tab, with the Two Minute Reports connector. If you are in more than one team, select your team in Select your Team.
- In Select Query Config, select your query config.
- Select Connect in the top-right corner.

- In your new report, add your Firestore fields to the canvas.

Dynamic dates
When your query config uses fixed date filters in a Structured query or FireSQL query, you have to update them manually. Instead, use the @startDate and @endDate parameters. When the query runs, Two Minute Reports replaces them with the report's date range.
This is especially useful with large Firestore collections. The connector fetches only the rows you need, and does not load the entire collection for Google Data Studio to filter later. This makes reports faster and reduces Firestore read costs.
Structured query, static dates:
collection: orders
filters: [{ field: "order_date", op: ">=", value: "2024-01-01" }, { field: "order_date", op: "<=", value: "2024-01-31" }]
Same query with dynamic dates:
collection: orders
filters: [{ field: "order_date", op: ">=", value: "@startDate" }, { field: "order_date", op: "<=", value: "@endDate" }]
FireSQL query, static dates:
SELECT * FROM orders WHERE order_date >= '2024-01-01' AND order_date <= '2024-01-31'
Same query with dynamic dates:
SELECT * FROM orders WHERE order_date >= @startDate AND order_date <= @endDate