How do I search a column for a word, and then get the location of the cell that contains that word?
Example: if the word I want to search was found in cell A6, I want to get A6.
My code below is able to find the word "xyz", but I don't know how to record its cell location in a variable.
function search() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
for(var i=1;i<sheet.getLastRow();i++){
var value = sheet.getRange(i, 1).getValue();
if(value == 'xyz'){
//how do I get the cell location of xyz?
var cell = ???
}
}
}
Thank you.