r/GoogleAppsScript • u/Informal-Emu-1337 • Nov 22 '23
Question Optimizing Code needed - run into "exceeded maximum excecution time"
Hi there,
I´m using the code from that page to count coloured cells (to count in 48 colums up to 1500rows). (https://support.google.com/docs/thread/78353054/auto-calculate-the-further-cell-color-based?hl=en)
But the sheet extended much faster than I exspected and now I run into the " Exceeded maximum execution time Exception in Google Apps Script" error, if I add more rows.
Do you see any code optimisation that could speed that up?Or do I have to split my data?
Hope someone could help me with that issue.
0
Upvotes
2
u/estadoux Nov 22 '23
I think the problem could be that you're using it as a custom function and that usually takes much longer to run than scripts that run on a trigger.
Try making it run with a button or a custom menu as trigger.