Skip to content

Instantly share code, notes, and snippets.

@dangtrinhnt
Last active July 3, 2018 06:11
Show Gist options
  • Select an option

  • Save dangtrinhnt/f4cee09c4621512303e3 to your computer and use it in GitHub Desktop.

Select an option

Save dangtrinhnt/f4cee09c4621512303e3 to your computer and use it in GitHub Desktop.
Find row number by value
function findRowByValue(sheet, value) {
var dataRange = sheet.getDataRange();
var values = dataRange.getValues();
for (var i = 0; i < values.length; i++) {
for (var j = 0; j < values[i].length; j++) {
if (values[i][j] == value) {
//Logger.log(i);
return i+1;
}
}
}
return -1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment