Typeerror: Cannot Call Method "getrange" Of Null. (line 9, File "code")
I am using the below filter function to copy data from one sheet to another, filtering out so that it only copies data if column AE = TRUE. When I use this script, it gives me the
Solution 1:
It means that tss.getSheetByName('Zones >20 Riders');
did not return anything. You need to check that indeed a sheet was found before trying to access it.
Here's the example provided at Google Docs:
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Expenses");
if (sheet != null) {
// Do your thing
}
If you are not sure what a method does, always check the documentation. For example, getRange returns the specified Range of cells in the sheet.
Solution 2:
try changing as below
Baca Juga
- Find Difference Between Two Arrays (missing Values) In Google Apps Script
- I'm Trying To Make An Id Searcher Which Does A Thing When You Input The Right Id. However, The If Statement Always Runs. Why Is This?
- Gas: How To Change A Global Variable Value And Preserve Its Changed Value When Using The Variable In A Handler Function?
var sss =
SpreadsheetApp.openById('1V3Tl4h43AC92K4gQtvdZ07k01QJOnfwSD1BKKTziHJU');
var ss = sss.getSheetByName('<20 Filter');
var sheet = ss.getSheets()[0];
varrange = sheet.getRange('A:AE');
var data = range.getValues();
note: getSheets Returns the sheet this range belongs to. please tick answered if this works for you.
Post a Comment for "Typeerror: Cannot Call Method "getrange" Of Null. (line 9, File "code")"