Home Product Blogs
Blaze
Have you ever come across situations where you need to bring data from Firebase Firestore to a Google Spreadsheet, work with the data and then push back the updates back to Firestore?

Sound magical, but we are giving you tools that will enable you to do this. Let's dive in.
Inorder to connect the addon with your Firestore we need a valid authetication mechanisam. We have made this part easiest and secured.
You can create a authticated user in Firestore console using the 'Email/Password' provider. You can then use this user to autheticate yourself with the Firestore server and work with the data. Apart from the user, the application also need web api key which you can find under the project settings page. We know that these are sensitive details, and you may be unsure whether to provide these details to third party app or not. To make to feel, the app is not sending these details to any external server. The app stores these in a service called "DocumentPropertiesServices" inside the Google Spreadsheet that you are using to connect. Also, all apps published in Google Workspace App Store goes through a review process to make sure that the app is legit and not doing any fraud operation. So you can trust the app and we are good to go!
Once you have all the required details available lets create a new connection.
To create a new connection open the flame app from the addon menu and it will bring a popup as shown below.
Provide the details, such as your firebase project id, the collection that you want to read, then the authentication details. Thats it, you are good to go. Lets do some action.
Create
To create a new document in the firestore, you need to populate the sheet with the data and click on 'create' button from the sidebar. In the sheet the first column is reserved for document id or document path. So it should be either $id or $path. Please note that any key that starts with '$' is used for internal references as primary or foreign keys and will not be added to the document.
As discussed earlier all the values will be by default considered as string, but if you need any values to converted you use the typecasting. In the current scenario if you need the phone numbers to be saved as numbers instead of string, you can use 'phone:int'
Once the documents has been created, the document id or path will be populated based on what you have to populate. $id will populate document id and $path wil populate full document path.
Read
To read the data from the Firestore, provide the column names that you need to fetch and click on the 'Read' button from the sidebar. The spreadsheet will be populated with the data from Firestore.
By default all the data will read as 'string'. But you can also typecast the data as shown below.
Boolean isActive:bool
Integer age:int
Double weight:double
Date / Timestamp dateOfBirth:timestamp
String name:string
Ref to another document cart:ref
We are also using three other type conversion. This is used by app when structuring and destrcuting the document. We can discuss about it later.
Array favoriteProducts:array
Object address:object
Collection orders:collection
Update
Update function works just like the create button, the only difference is that you have to give the document id which needs to be targeted for teh update. Rest, its just the same as Create action.
If the document is not available by the given document id, the method does nothing. It will not create a new document.
Delete
Deletes the document from Firestore. Please note that the delete method runs on the given document id. Hence, If there are subcollection within the document it will not deleted.
But there is no need of panic. If you have by mistake done something like this, you can then run 'Read', which will read subcollection and collection groups. You will then be able to identify the documents that don't have parents and then remove it.
Now you know about the very basic working of Flame.
We are stoping here for now, but this is not the end, we will be soon posting videos turorial, please watch this space for the same.
If you have any doubt please let us know, You can reach us at [email protected]