Need to delete an entire row based on one cell's criteria

后端 未结 1 1038
孤城傲影
孤城傲影 2021-01-16 04:09

In Google Sheets, I am trying to delete an entire row when one cell in that row contains the phrase \"Delivered.\" The onEdit function won\'t work for my needs because it re

1条回答
  •  不知归路
    2021-01-16 04:27

    Try this:

    function createTimeBasedTriggerIfYouDontAlreadyHaveOne() {
      if(!isTrigger(deleteDeliveredRows)) {
         ScriptApp.newTrigger(deleteDeliveredRows).timeBased().everyDays(1).atHour(0).create();
      }
    }
    
    function deleteDeliveredRows() {
      var ss=SpreadsheetApp.openById('ssid')
      var sh=ss.getSheetByName('sheetname');
      var rowStart=2;//assume 1 row for headers
      var rg=sh.getRange(rowStart,1,sh.getLastRow()-rowStart+1,sh.getLastColumn());
      var vA=rg.getValues();
      var d=0;
      for(var i=0;i

    0 讨论(0)
提交回复
热议问题