This code gives me exactly what I want: the values of the last row. Now I am trying to overwrite/replace these values in some cells in that very same last row. By “some cells” I specifically mean 2 cells, where I want to put new values coming from another/good-working function. Any idea how this can be done?
Thank you so much in advance for your help :).
function changeCellValueInLastRow() {
var ws = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("SHEET_NAME");
var data = ws.getRange(ws.getLastRow(), 1, 1, ws.getLastColumn()).getValues();
Logger.log(data);
}
CodePudding user response:
function changeCellValueInLastRow(v, col = 1) {
if (v && col) {
const ss = SpreadsheetApp.getActive();
const sh = ss.getSheetByName('SHEET NAME');
sh.getRange(sh.getLastRow(), col).setValue(v);
}
}