无法获取Firebase Google应用脚本快速入门教程 [英] Can't Get Firebase Google App Script Quickstart Tutorial to Work

查看:212
本文介绍了无法获取Firebase Google应用脚本快速入门教程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎无法获取



这是我不断收到的错误:



我的脚本在FireBase站点中的名称:

解决方案

所以我想我错过了一个重要的观点。 firebase数据库的网址有你的projectId。所以这个url就像 https://'+ projectId +'.firebaseio.com'。对不起,用这么简单的问题打扰大家。

I can't seem to get the Firebase QuickStart to work for me. I'm pretty sure that I followed all of the instructions correctly. But I'm not getting access to write to the database. And according to the instructions the database is currently open to the public with the suggest rules change displayed below. Has anybody ever gone through this tutorial before? I'd like a hint as to what to do next.

Here's the code.

  function writeDataToFirebase() {
  var ss = SpreadsheetApp.openById("1rV2_S2q5rcakOuHs2E1iLeKR2floRIozSytAt2iRXo8");
  //var ss = SpreadsheetApp.getActive();//I tried running it with data in this spreadsheet copied from the recommended source
  var sheet = ss.getSheets()[0];
  //var sheet = ss.getActiveSheet();
  var data = sheet.getDataRange().getValues();
  var dataToImport = {};
  for(var i = 1; i < data.length; i++) {
    var firstName = data[i][0];
    var lastName = data[i][1];
    dataToImport[firstName + '-' + lastName] = {
      firstName:firstName,
      lastName:lastName,
      emailAddress:data[i][2],
      country:data[i][4],
      department:data[i][5],
      weight:data[i][6],
      birthDate:data[i][7]
    };
  }
  var firebaseUrl = "https://script-examples.firebaseio.com/";
  var base = FirebaseApp.getDatabaseByUrl(firebaseUrl);
  base.setData("", dataToImport);
}

The Data:

This is my library dialog:

This is the error I keep on getting:

This name of my script in the FireBase Site:

This is the access rules change:

解决方案

So I guess I missed an important point. The url of firebase database has your projectId in it. So the url would be something like https://' + projectId + '.firebaseio.com'. Sorry, to bother everyone with such a simple question.

这篇关于无法获取Firebase Google应用脚本快速入门教程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆