Created
July 27, 2015 16:57
-
-
Save MauricioMoraes/a8f4b4bd89b647b749f5 to your computer and use it in GitHub Desktop.
Google Apps Script for Spreadsheets - Find the relative row number within a range that has a a cell with given target value - Range in A1 Notation starting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findRowNumberForCellWithValue(targetValue, rangeA1Notation, sheet) { | |
var range = sheet.getRange(rangeA1Notation); | |
var values = range.getValues() | |
for (var i = 0; i < values.length; i++) { | |
if (values[i][0] == targetValue) { | |
return i+1; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: Getting the line number of the first empty cell on first column
This is very useful for many logger scripts where you have to fill the last line with the updated value.