I have a function starting off as such
function onEdit2(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
// Returns the active cell
var activeRange = sheet.getActiveRange();
Logger.log(activeRange.getA1Notation());
I have this function triggered 'on change' in a spreadsheet (it was originally on edit, hence the name, but that isn't triggered by changing background color, which is kinda critical to what I'm doing with this).
This always writes A1 to the logger, no matter what part of the spreadsheet I have selected, and it does the same thing with getActiveCell in place of getActiveRange.
Is there any way to get the selected range when a script runs?