I think most of my errors come from the updates of Firebase. But I'm getting there.
Still loving Firebase!
Ok, I'm trying to export a column demo Spreadsheet to Firebase (code bellow). The error seems to be related to the Firebase reference. I know how to fix it in my Firebase projects, but this is hooked into the Script editor of the spreadsheet.
ERROR: ReferenceError: "FirebaseApp" is not defined. (line 13, file "export")
function writeDataToFirebase() {
var ss =
SpreadsheetApp.openById("1rV2_S2q5rcakOuHs2E1iLeKR2floRIozSytAt2iRXo8");
var sheet = ss.getSheets()[0];
var data = sheet.getDataRange().getValues();
var dataToImport = {};
for(var i = 1; i < data.length; i++) {
var year = data[i][0];
dataToImport[year] = {
caption:data[i][1]
};
}
var firebaseUrl = "https://test-db-9833d.firebaseio.com/";
// ERROR HERE ********************************************
var base = FirebaseApp.getDatabaseByUrl(firebaseUrl);
base.setData("", dataToImport);
}
Following is the right answer: In the script there is a resources tab to add a library: Search: MYeP8ZEEt1ylVDxS7uyg9plDOcoke7-2l and choose 11-static then rerun your script
documentation: https://sites.google.com/site/scriptsexamples/new-connectors-to-google-services/firebase
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With