Google Script: Getvalue From Row With Today's Date
I am working with google sheets scripting and am trying to identify values which exceed a certain threshold. In this case there are 3 variables f1,f2 and pf. When the cell with the
Solution 1:
Getting daterange
gives you a Range Object which you need to iterate in order to match a specific cell. First, we need to get a range of dates and then nullify timestamp information before comparing. Make the following changes:
// set and store a date object for todayvar date = sheet.getRange("F1").setValue(newDate()).getValue();
// Get the range of dates to testvar daterange = sheet.getRange("A3:A").getValues()
// iterate the values in the range objectfor(var i=0; i<daterange.length; i++) {
// Compare only month/day/year in the date objectsif(newDate(daterange[i]).setHours(0,0,0,0) == date.setHours(0,0,0,0)) {
// if there's a match, set the row// i is 0 indexed, so add 3 to get the correct rowvar today_row = (i+3);
// rest of your code
}
}
I haven't tested each of your variables set in the if
block, but this bit returns a correct evaluation of the date as well as the correct row.
Post a Comment for "Google Script: Getvalue From Row With Today's Date"