In Google Sheets, I need to hide rows if column H says, "Completed"

My preference would be to cut and copy the row to a new sheet if column F reads "Completed", but sounds more difficult.

If you have the time to explain this, it would be great.

Currently, I have a Query function on another sheet which will copy a row if that rows column F reads, "completed", but if I then delete the row off of the original sheet, then of course it disappears.

1 Answer 1


use this script which will check H column and when it finds Completed it will move the whole row (A:Z) from Sheet1 into Sheet2 and then delete row from Sheet1

function copyrange() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName('Sheet1'); //source sheet
  var testrange = sheet.getRange('H:H'); //range to check
  var testvalue = (testrange.getValues());
  var csh = ss.getSheetByName('Sheet2'); //destination sheet
  var data = [];
  var j =[];

  //Condition check in H:H; If true copy the same row to data array
for (i=0; i<testvalue.length;i++) {
  if ( testvalue[i] == 'Completed') {
  //Copy matched ROW numbers to j
//Copy data array to destination sheet


//Delete matched rows in the source sheet
  for (i=0;i<j.length;i++){
  var k = j[i]+1;

//Alter j to account for deleted rows
  if (!(i == j.length-1)) {
  j[i+1] = j[i+1]-i-1;

Not the answer you're looking for? Browse other questions tagged or ask your own question.