Reputation: 85
I have a script in google Spreadsheet, which gets the active cell and then the row and column of the active cell:
function editedCellResponse() {
var s = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getActiveCell();
var r = s.getRow(); // gets row of edited cell
var c = s.getColumn(); // gets column of edited cell
... script then goes on doing what ever
}
This script also has an onEdit trigger so it's triggered at each edit of the spreadsheet. However either the getActiveCell doesn't work or the getRow and getColumn don't work because the (row, column) result is always (1, 1) regardless of the active cell. The funny thing is as I was first writing the script this all worked and I never changed anything, but now all of a sudden nothing works because the script seems to be reading the active cell or row and column wrong.
Any ideas as to what might be wrong?
Upvotes: 1
Views: 3456
Reputation: 64032
Try this:
function onEdit(e){
var r = e.range.getRow();
var c = e.range.getColumn();
Logger.log('%s,%s',r,c);
}
Upvotes: 2