Hi i have a column G2: G in googlesheet named 'Rank sheet' with storename like
column G
storeA
storeB
storeC
storeA
storeA
storeD
I want to create a function name 'remove' (google apps script) to delete row of duplicated names, but when i run it, gsheet say :"TypeError: Cannot read property "length" from undefined." Can anyone can help me to fix it or help with your code. Thank so much My code is:
function remove() {
var range2 = rankSheet.getRange("G2:G");
var values2 = range2.getValues();
for (var n = 0; n < values2.length; n++) {
if(values2[n] == values2[n+1]) {
var outarray = []
outarray.push(n+2)
Logger.log(outarray)
}
}
for (var m = 0; m <= outarray.length - 1; m++) {
rankSheet.deleteRow(outarray[m]);
}
}