79142486

Date: 2024-10-30 19:05:57
Score: 0.5
Natty:
Report link

atlascode answer is good:

=myFunction(CELL("address", D3:Y23))

But... for some reason it didn't get all the cells, only the first one (D3), and the script won't detect changes in these cells.

I end up doing something like this:

function example(row_a, col_a, row_b, col_b, watch){

  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  let range = sheet.getRange(
    row_a, col_a, 
    row_b-row_a + 1, 
    col_b-col_a + 1);
//...
}

My workaround is to put an extra watch parameter in the function so the user can insert the range, and the script will detect any updates in those cells. You don't need to do anything with it.

And you call the function like this:

=example(row(A1), column(A1), row(B2), column(B2), A1:B2)
Reasons:
  • RegEx Blacklisted phrase (0.5): any updates
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: stoiaMillawi