I just started with js and I'm trying to make a script in Google Sheets:
https://docs.google.com/spreadsheets/d/1mNBThO2gBpvqQxrLE_hDxLuV--cTc42K8q37ZQG9TCc/edit?usp=sharing
function makeVariants() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("VARIANTSOK");
var righe = sheet.getLastRow();
var lastColumn = sheet.getLastColumn();
var lastCell = sheet.getRange(righe, lastColumn);
Logger.log(lastCell.getValue());
for (i=0; i<righe; i++) {
if (sheet.getRange(righe[i], 2, 1, 1) = sheet.getRange(righe[i-1], 2, 1, 1)) {righe[i].clear();}
}
}
how to loop so that the second cell in B column "B3" gets compared with the above one "B2" and get deleted if it's identical?
I have tried to get the last row, increment the last row + 1 and compare with the above one and gets deleted eventually. I'm having difficulties putting this in a loop.
In the sheet attached B11 and B10, B8, B6, and B4 and B3 should get deleted.