【发布时间】:2019-04-02 10:05:01
【问题描述】:
我正在尝试借助 FirestoreGoogleAppsScript 示例从 Google 表访问 Cloud Firestore 数据库,但正如第 5 点所述,我已经下载了文件,但没有找到更新 client_email、private_key 和project_id 在项目中。
所以请引导我继续前进。
当您按“创建”时,您的浏览器将下载一个带有您的私钥 (private_key)、服务帐户电子邮件 (client_email) 和项目 ID (project_id) 的 .json 文件。将这些值复制到您的 Google Apps 脚本中——您将需要它们来通过 Firestore 进行身份验证。
带有演示 代码.gs
function myFunction() {
projectid: "xxx";
key: "-----BEGIN PRIVATE KEY-----\nPrivateKeyHere\n-----END PRIVATE KEY-----\n";
email: "xxx@xxx.iam.gserviceaccount.com";
var firestore = FirestoreApp.getFirestore(email, key, projectId);
}
错误
ReferenceError: "email" is not defined. (line 7, file "Code")
【问题讨论】:
标签: firebase google-apps-script google-sheets google-cloud-firestore