Skip to content

Instantly share code, notes, and snippets.

@eojji
Created August 28, 2018 07:33
Show Gist options
  • Save eojji/0fe300832b7426464a1c7bdda1ebe92e to your computer and use it in GitHub Desktop.
Save eojji/0fe300832b7426464a1c7bdda1ebe92e to your computer and use it in GitHub Desktop.
Find duplicate rows in the spreadsheet with the eq function and delete them. https://cafe.naver.com/eojji/365
function myFunction() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var value;
var i = 0;
var thisRow = 2;
do {
value = sheet.getRange(thisRow, 1).getValue();
if (value) {
thisRow++;
} else {
sheet.deleteRow(thisRow);
}
i++;
} while (thisRow <= sheet.getLastRow() && i < 1000);
Logger.log('Row: %s', thisRow);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment