and here is a 'script solution' you could try. There are many possible approaches, this is one of them...
function testfindRow(){ ;// this function only to test the other one by giving it a parameter and using its result.
var ss = SpreadsheetApp.getActiveSpreadsheet();
var otherSheet=ss.getSheets()[1];// assuming there is a second sheet to copy to
var datatocopy=findRow('Hello');
Logger.log(datatocopy)
if (datatocopy!=-1){
otherSheet.getRange(otherSheet.getLastRow()+1,1,1,datatocopy[0].length).setValues(datatocopy);
}
}
//
function findRow(item) { ;// the actual search function
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet=ss.getSheets()[0];
var values = sheet.getDataRange().getValues();
for(cc =0; cc < values.length; ++cc) {
if(values[cc].toString().match(item)==item){break};// here you can eventually use string modifiers like toLowerCase() to allow for wider search criteria
}
Logger.log(cc);// the array index in which the result was found, cc+1 is the Row index
if (cc==values.length){return -1}
var resultArray=sheet.getRange(cc+1,1,1,values[cc].length).getValues()
return resultArray ;// the returned value is a 2 dimensions array to use with setValues()
}
Following your comment, here is a version that returns all Rows containing the item, I had to change the error trapping as well but the whole things is quite simpler after all.
function testfindRow(){ ;// this function only to test the other one by giving it a parameter and using its result.
var ss = SpreadsheetApp.getActiveSpreadsheet();
var otherSheet=ss.getSheets()[1];// assuming there is a second sheet to copy to
var datatocopy=findRow('Hello');
if (datatocopy.length>0){
otherSheet.getRange(otherSheet.getLastRow()+1,1,datatocopy.length,datatocopy[0].length).setValues(datatocopy);
}
}
//
function findRow(item) { ;// the actual search function
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet=ss.getSheets()[0];
var resultArray=new Array();
var values = sheet.getDataRange().getValues();
for(cc =0; cc < values.length; ++cc) {
if(values[cc].toString().match(item)==item){// here you can eventually use string modifiers like toLowerCase() to allow for wider search criteria
// or like this to search only in column D // if(values[cc][3].toString().match(item)==item){
resultArray.push(values[cc]);
};
}
Logger.log(resultArray);// the array of Rows in which the item was found,
return resultArray ;// the returned value is a 2 dimensions array to use with setValues()
}
=QUERY('All the data'!A:D;"select * where D contains 'hello'")
. Note this will find "hello" in "Othello". – AdamL