I am running a script to check for the last number and get a value to move up by one. I have done a similar code before without issues, but for some reason I am getting errors on checking if the first portion is running correctly. I have check that the SheetName is correct.Here is a copy of the simple code
function generateEmpID() {SpreadsheetApp.getActiveSpreadsheet().getSheetByName("EmpID").getRange(2,1).getValue();console.log(SpreadsheetApp.getActiveSpreadsheet().getSheetByName("EmpID").getRange(2,1).getValue());}And this is the response I get:
12:01:35 PM Notice Execution started
12:01:36 PM Error TypeError: Cannot read property 'getSheetByName' of nullgenerateEmpID @ Code.gs:3