Forum Discussion
Power Automate - iAuditor integration to Excel for business
Hi all,
I'm trying to build a flow in Power Automate to feed data in Excel file (located on SharePoint) used for my Power BI report but i don't know why it does not want to work.
This is my flow as shown in the photo
In the first "For Each" action i have " body('Site') ", second " body('Serial Number') ".....
When i test this is how it looks like
If i remove the second and third FOR EACH, it goes to the excel action and stops there.
Does anyone have a similar flow or does anyone know what i'm doing wrong?
Thank you in advance if anyone has a solution.
1 Reply
- cyberunitedCopper Contributor
Nested "Apply to each" loops are usually the problem here. Each loop runs once for every item in the loop above it, so with three of them you get every combination of site, serial number and so on, rather than one row per inspection. It is also very slow, which can look like the flow stopping.
What tends to work better:
- Use a single "Apply to each" over the main array, the list of inspections or items.
- Inside it, pick each value from the current item, for example items('Apply_to_each')?['site'], instead of looping over each field separately.
- Put "Add a row into a table" inside that one loop.
Two Excel points as well. The data needs to be formatted as a table (Insert, then Table) in a file at a fixed location. And set the loop's concurrency to 1, because Excel doesn't handle lots of rows arriving at once well.
If this feeds Power BI and will grow, a SharePoint list is usually more reliable than Excel as the landing place, and Power BI reads it just as easily.