the below code is awesome and remove the duplicates but there is one thing i want to change for example if i have column A and it contain duplicate values and column B contains unique values in this case the function don't remove the duplicates from Column A because some how it Join Column A & B together then it removes the duplicate.
what i need is to remove the duplicates based on Column A only whatever Column B is Unique Value or not
here is a sample sheet with dummy data https://docs.google.com/spreadsheets/d/13ViFiwoA_29oo-nz2LUK3CD7DiRqDRTW1blJRE6XHm4/edit?usp=sharing
function removeDuplicates() {
var sheet = SpreadsheetApp.getActiveSheet();
var data = sheet.getDataRange().getValues();
var newData = [];
for (var i in data) {
var row = data[i];
var duplicate = false;
for (var j in newData) {
if (row.join() == newData[j].join()) {
duplicate = true;
}
}
if (!duplicate) {
newData.push(row);
}
}
sheet.clearContents();
sheet.getRange(1, 1, newData.length, newData[0].length).setValues(newData);
}