I'm writing an ArrayFormula so I can fill many rows in my sheet with one formula. This formula needs to use an Apps Script that I wrote, which does some calculations based on the row number.
But whenever I use sheet.getActiveCell() or sheet.getCurrentCell() in the script, I get back the cell where the formula is written (i.e. at the top of my sheet), not the cell corresponding to the row currently being filled in by the ArrayFormula.
How can my Apps Script know which row is currently being filled in by the ArrayFormula?