After integrating Firebase with your app, now you need reporting. Reporting is very difficult in Firebase. We make it easy and need not be super complicated. In a few minutes, we’ll show you how to get your Firebase data to Google Sheets.
Without writing a single line of code you can automatically pull the latest data from Firebase Cloud Firestore to Google Sheets. All this without sacrificing data security, with our encrypted Google setup and data stored in your private Google Sheet, you can be confident that you are safe. Let me show you how.
Let’s get started. We are going to enable read permission and create a service account key in Firestore.
Step 1: Enable read permission
In the Firestore dashboard, Click on Rules. By default, the “read” and “write” permission will be False. Now, you would need to enable the read permission as True.
Code Snippet :
rules_version = ‘2’;
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read: if true;
allow write: if false;
}
}
}
Step 2: Generate a service account key
- Click on the Project setting.
- Go to the service account in the dashboard and generate a new service account key
The Key is downloaded as a JSON file format. Using this you can pull data from Firestore to Google Sheets.
Step 3: Install and Launch Two Minute Reports
Install Two Minute Reports, if you have not done already.
Sign in to any Google Sheet and go to Add-ons -> Get add-ons.
Search for Two Minute Reports and select Install.
Review and accept the permissions necessary to run Two Minute Reports. Two Minute Reports will be installed for you with the e-mail you are sign in to Google Sheets.
Open Google Sheets and go to Extensions -> Two Minute Reports -> Launch.
Step 4: Add a new Data Source
After installing Two Minute Reports go to the Data Source section. We will connect your service account with Two-Minute-Reports here.
- Go to the Data Sources section.
- Select Firebase from the drop-down
- Copy & paste the values of the generated json file we received from the previous step in the text area
- Press Test Connection and you are now ready to start pulling data
Step 5: Fetch Firestore Data onto Google Sheet
Now that your data source has been connected, you can write your own Firestore queries and start fetching data onto the Google Sheets
- Go to the Data Queries section and press Add
- Select your newly added Data Source and write your query
- You can write Two Type of Queries in Two Minute Reports
- You can even write SQL Queries like
"Select * from collectionName"
in Two Minute Reports to fetch your Firestore data into Google Sheets - Otherwise you can also write Structured Queries to write your FireStore queries. and you can learn more about them.
- You can even write SQL Queries like
- Once a query runs successfully, you should see the data populate on your spreadsheet
Step 6: (Optional) Schedule and e-mail reports
Once you have fetched data once, you might want to get new data from your database at periodic intervals. You can do this creating a new schedule under the “Schedule Reports” section. You can schedule updates hourly, daily, weekly or monthly based on your needs.
You could also create a report and ask Two Minute Reports to email that report with updated data automatically. Under the email section enter the email Id of the recipients and save your new schedule.
When the time comes, Two Minute Reports will automatically fetch new data from your queries, and email your report to the said recipients. You have freed a lot of your time from mundane reporting tasks.
There are other features with Two Minute Report’s schedule refresh or data refresh feature. You may read our guide How to Refresh Data Automatically in Google Sheets.
Try Two Minute Reports for Free by installing from the GSuite marketplace, and start managing your SEO tasks in a breeze within Google Sheets. Cheers!