Home > Mobile >  read a range between two rows with the same value
read a range between two rows with the same value

Time:12-06

I am trying to read the last added range of data ("A10:C15") delimited by a custom row (i.e. row 1, row 9) that will dynamically get added into the sheet.

So far I've just managed to read the entire sheet with getRange("A1:C15") but I cannot use only values in range "A10:C15" (and any other newly added range).

image1

CodePudding user response:

  • Get all the data
  • Do a reverse for-loop and get data up to the delimiter
const values = sheet.getDataRange().getValues(),
  lastSet = [];
for( let i = values.length; i>=0 ; i-- ){
  if (values[i][0] === "xxx" ) break;
  lastSet.push(values[i])
}
console.info({lastSet});
  • Related