Answer the question
In order to leave comments, you need to log in
How to fix TypeError: Cannot read property '0' of null?
Good day!
Can you please tell me how to fix the error "TypeError: Cannot read property '0' of null"? In the program Google Apps Script (Tables) implemented the ability to "pull" a specific value from the site. For example, prices. Everything was fine before, but now for some reason this error began to appear.
The code:
function getData(){
const ss = SpreadsheetApp.getActive();
const sheet = ss.getSheetByName('data');
const data = sheet.getDataRange().getValues();
data.map((row, i) =>{
if(i>0 && row[0]){
const response = UrlFetchApp.fetch(row[0]).getContentText();
const match = response.match(new RegExp(row[1]))[0];
sheet.getRange(i+1, 3, 1, 2).setValues([[true].concat(match)]);
SpreadsheetApp.flush();
}})
}
function getLastRow(data, column){
return Math.max(...(data.map((g, i) => !g[column-1] ? '' : ++i)));
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question