I wanted to read data from the webpage for this I have used the Importdata function. For auto-refresh wrote a script. Below is the code. I am getting error like TypeError: Cannot read property 'getRange' of null (line 16, file "Code") How to get rid of this error.
function getData() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("2020 MTD");
var queryString = Math.random();
var cellFuntion = '=IMPORTDATA("https://dosairnowdata.org/dos/historical/NewDelhi/2020/NewDelhi_PM2.5_2020_05_MTD.csv")';
sheet.getRange('A1').setValue(cellFuntion);
}