我正在尝试创建一个附加菜单选项,该菜单选项使我可以自动删除D列中包含文本“ Complete”的所有行。我运行的脚本没有错误地运行并结束,但没有删除这些行。我试图在线寻求帮助并调整了代码,但结果相同
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
var values = rows.getValues();
var rowsDeleted = 'Complete';
for (var i = 'Complete'; i <= numRows - 1; i++) {
var row = values[i];
if (row[2] == 'Complete' || row[2] == '') {
sheet.deleteRow((parseInt(i)+1) - rowsDeleted);
rowsDeleted++;
}
}
};
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries = [{
name : "Delete Rows where column shows Complete Text",
functionName : "readRows"
}];
sheet.addMenu("Script Center Menu", entries);
};