When it comes to calling in the active elements, I have been using event.source.getActive
and SpreadsheetApp.getActive
. However, I have noticed that I sometimes interchange them in my script and face issues. So, I am unsure about which method is more appropriate. Do I really need both of them or is there a preferred way to do this?
var ss = SpreadsheetApp.getActiveSpreadsheet();//ss is active spreadsheet
var s = event.source.getActiveSheet();//s is active sheet within the spreadsheet
var r = event.source.getActiveRange();//r is active cell
var sheetAppActive = SpreadsheetApp.getActiveSheet();//sheetAppActive is the active sheet within the spreadsheet
var rangeAppActive = sheetAppActive.getActiveCell(); //rangeAppActive is the active cell