Reputation: 79
I'm trying to get my table data to my firestore app but such error keep showing :
TypeError: Cannot read property 'getLastRow' of null (line 14, file "Code")
I've done all configuration and I added Firestore library to Apps Script
function covidFunc() {
const email = "[email protected]";
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
}
Upvotes: 0
Views: 127
Reputation: 27348
Your active spreadsheet file; the one that your google apps script project is attached to, should have a tab/sheet with the name: US-covid
. Your screenshot just provides a spreadsheet file with the name US-covid. But a tab/sheet should have it.
Example:
Upvotes: 1