问题描述
我正在尝试将我的表数据发送到我的Firestore应用程序,但是出现此类错误 一直显示:TypeError:无法读取null的属性“ getLastRow”(第14行,文件“代码”)
完成所有配置,并将Firestore库添加到应用脚本
function covidFunc() {
const email = "myproject@appspot.gserviceaccount.com";
const key = "-----BEGIN PRIVATE KEY--------END PRIVATE KEY-----\n";
const projectId = "my project id";
var firestore = FirestoreApp.getFirestore (email,key,projectId);
// get document data from ther spreadsheet
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheetname = "US-covid";
var sheet = ss.getSheetByName(sheetname);
// get the last row and column in order to define range
var sheetLR = sheet.getLastRow(); // get the last row }
[1]: https://i.stack.imgur.com/4Nw6k.png