I want to add a text to last column of all selected rows:
var sh = ss.getActiveSheet();
lCol = sh.getLastColumn()
var selected_cells=ss.getActiveRangeList()
var rgs=selected_cells.getRanges();
for (var i = 0; i < rgs.length; i++) {
var range=rgs[i];
var lRow=range.getRow();
var cell = sh.getRange(lRow,lCol+1,1,1);
var firstname=sh.getRange(lRow, 2).getValue();
var lastname=sh.getRange(lRow, 3).getValue();
var email=sh.getRange(lRow, 8).getValue();
var link="http://192.168.80.1/d/?email="+email+"&firstname="+firstname+"&lastname="+lastname;
cell.setFormula("=HYPERLINK(\""+link+"\",\"click\")");
}
But it justs adds to first row. What am I missing?