@Luis O Thanks for reaching out.
As you have business logic in your logic app and individual execution of action takes time and if you have more actions in your workflow then it will take more time for the execution and if you need more performance then you can review the below optimization in your flow:
- Wherever possible use the function reference in your action to minimize the number of actions that your workflow executes. For example, you can use if condition as an inline function with multiple cases rather than using the switch statement.
- Run your foreach in parallel rather than sequential wherever possible.
- I will suggest you to leverage the inline query action to do the calculation as it would be way more faster for these type of object modification/calculation but inline query does have the limitation on run duration, data size etc so please refer to the limitation before following this approach.
- Alternatively, the best approach would be offloading this functionality/calculation to azure function and call azure function from logic app with your custom data and then loop in though the return object to insert it to excel.
Feel free to get back to me if you have any queries or concerns.
Please click on 'Yes' if it helped so that it can help others in the community looking for help on similar topics.