0

I have a custom function which populates a sheet with data. It returns a multi dimensional array. I want to setup row groups automatically when the data is loaded.

Both functions work correctly (Features() being the one returning the data and SetupRowGroups() being the one which sets up the row groupings) as standalone functions. After the Features() function running, I currently have to manually trigger (via a custom menu, that I created) setting up of the rows. What I want to achieve is the setting up of the rows automatically (no manual intervention) after Features has been run.

What I have tried so far:

  • calling my setupRowGroups function inside Features()
    • I get this error back;  a custom function cannot edit arbitrary cells, only the cells it is called from and their adjacent cells. To edit arbitrary cells, use a custom menu to run a function instead.
      • I understand why this is thrown.
  • I looked at onEdit trigger on the sheet that has been populated by Features(), but am seeing a number of problems;
    • as Features() is populating many rows, I am getting multiple onEdit triggers. When I get the onEdit trigger, and try to execute the setupRows, it's working on similar rows that Features is populating, so I am seeing multiple failures. It's like a race condition.

Any advice on ways to achieve this; automatically triggering a custom function directly after another custom function completes?

Rubén
  • 29,320
  • 9
  • 61
  • 145
ccfoley
  • 1
  • 1
  • 1
    It seems you are trying to call a custom function from a custom function =FUNC1(FUNC2()). Is that correct? Post your code so we can see how these can work together. – TheWizEd Mar 11 '22 at 15:08

0 Answers0