谁能告诉我为什么这个功能不起作用?产生错误“无法在对象表中找到函数clearContent()”
function removeDuplicates() {
var sheet = SpreadsheetApp.getActiveSheet();
var data = sheet.getDataRange().getValues();
var newData = new Array();
for(i in data){
var row = data[i];
var duplicate = false;
for(j in newData){
if(row[1] == newData[j][1] && row[2] == newData[j][2] && row[3] == newData[j][3] && row[6] == newData[j][6] && row[7] == newData[j][7] && row[8] == newData[j][8]){
duplicate = true;
}
}
if(!duplicate){
newData.push(row);
}
}
sheet.clearContent();
sheet.getRange(1, 1, newData.length, newData[4].length).setValues(newData);
};
提前致谢。