Using google apps script, we can sync the content of a google sheet to Firebase realtime database.
My usecase- update food ordering app's menus by only changing the google sheet, without the need to code or access the database.
You need to have the firebase realtime database setup and the google sheet that you would like to sync data from. The database rules must allow reading and writing (this can be changed later).
- Inside the sheet, go to
Tools -> Script editor
- Replace the content of
Code.gs
andappsscript.json
files with the ones here. - Insert your spreadsheetID and firebaseUrl inside the
getEnvironment()
function in theCode.gs
file - Adjust the
formJSON()
function insideCode.gs
to create the object that you would like to sync. - Go to
Run -> Run function -> initialize