Firestore Emulator Load Data

2023-01-28

Getting data from Firestore in the cloud to local can be done using a paid app such as FireFoo or from the command line using the cli tools provided by Google.

I’ll assume you have the firebase CLI installed as you have the emulator already. The gcloud tools are available for nearly all platforms.

Once you have them setup, run the initialization

firebase login
gcloud auth login

Make sure you are using the right projects. For firebase you are most likely setup but you can check with

firebase projects:list
firebase use your-project-name

The command for gcloud are similar

gcloud projects list
gcloud config set project your-project-name

now do a backup if you have not already

gcloud firestore export gs://your-project-name.appspot.com/folder-name

cd into a temp folder and download with a copy command.

gsutil -m cp -r gs://your-project-name.appspot.com/folder-name .

Make sure the emulator is not running and copy those contents to over the existing files in you emulator folder.