I was recently working on a project in which I needed to extract all my user’s data stored in Firebase’s Firestore database, to send them an important email regarding some user policy changes.
What I wanted to do is to extract all the data & save it in a CSV file. After which I can easily send emails via SendInBlue’s email campaign. So here’s what I did.
As usual, just head over to your firebase console.
Open the Firebase project from which you want to extract the user’s data. Once loaded, click on the gear icon appearing near the top-left area and select the “Project settings” option.
Now head over to the “Service accounts” section and scroll all the way down and click on the “Generate new private key” 🔑 button to generate & download a new JSON key file.
- This JSON file contains all the information that anyone would need to get access to your Firebase project. So always keep it safe. In case you lose it, repeat step 2 to be safe :)
Lets fire up the terminal and install the Firebase Admin SDK in Python.
pip install --upgrade firebase-admin
Once the Firebase Admin SDK is ready to be used, download the “users_to_csv.py” and run it with Python 🐍
Hurray 🎉!!! Now you have all your users data into one well-formatted CSV file.
Thanks for reading through this article! If you enjoyed it, please click the 👏 button & feel free to leave your response below.