How to write a trigger which gets triggered everytime the user selects any cell. The trigger will call a function which would log the row number of the highlighted cell on Google Apps Scripts
I have already written a function which is doing that:
function getCell() {
var app = SpreadsheetApp;
var ss = app.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
//get the current highlighted cell
var cell = sheet.getCurrentCell();
//get the row number
var row = cell.getRow();
//log the value
Logger.log(row);
}
But I don't know how to write the trigger. Currently, I have to run the script every time I click on some other cell.