web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Iterate through excel ...
Power Automate
Answered

Iterate through excel rows

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello everyone,

 

I have made a flow that it is getting a HTML file from SharePoint Library it's updating some data (stored in a excel file also uploaded in SharePoint Library) and update the HTML file.

Files used:

HTML file:

CristianF_0-1615972542548.png

Excel file for data updating:

CristianF_1-1615972627420.png

 

As i was saying - the flow picks that label made in HTML and updates %code1,2,3,4,5% with info from excel file.

CristianF_4-1615972985082.png

CristianF_5-1615973056489.png

CristianF_7-1615973157399.png

 

The flow is working perfectly !

CristianF_8-1615973492328.png

 

Note*: Excel table contains 2 rows !

Now comes my question:

What needs to be done so this flow will iterate through the excel table and create as many labels as rows number in the excel table ? In my table, there are 2 rows, but at this moment the flow is picking only the first one.

 

Thank you in advance for your support !

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @Anonymous i see that you have apply to each actions to loop through excel rows, but the compose action used inside apply to each action will retain the value of only one row, if you want value of all rows, then you need to define array variable in start of flow and then use Append to array variable inside the apply to each action.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you @annajhaveri for replaying !

     

    I have changed the 'Apply to each' and adjust it properly (I think).

    Now the flow is making to many duplicates of the label. As far as I can see, it is making a duplicate for each 'Compose' and its making one change per each label (%code1% in first label, %code2% in second label, %code3% in 3rd label and so on).

    CristianF_0-1616500537632.jpeg

    Result: (I put only 3 examples but the flow its making 10)

    CristianF_2-1616500810573.png

     

     I even changed the flow and leave only one 'Compose' with all the replacement

    CristianF_3-1616501022847.png

    Replacement expressions:

    Spoiler (Highlight to read)

    replace(variables('LabelCode'), '%code1%', items('InitializeReplacements')?['ITEM_CODE'])

    replace(variables('LabelCode'), '%code2%', items('InitializeReplacements')?['CUSTOMER_ITEM_CODE'])

    replace(variables('LabelCode'), '%code3%', body('Convert_time_zone'))

    replace(variables('LabelCode'), '%code4%', items('InitializeReplacements')?['QTY'])

    replace(variables('LabelCode'), '%code5%', items('InitializeReplacements')?['ITEM_CODE_DESCRIPTION'])

    replace(variables('LabelCode'), '%code1%', items('InitializeReplacements')?['ITEM_CODE'])replace(variables('LabelCode'), '%code2%', items('InitializeReplacements')?['CUSTOMER_ITEM_CODE'])replace(variables('LabelCode'), '%code3%', body('Convert_time_zone'))replace(variables('LabelCode'), '%code4%', items('InitializeReplacements')?['QTY'])replace(variables('LabelCode'), '%code5%', items('InitializeReplacements')?['ITEM_CODE_DESCRIPTION'])

    What am I doing wrong ? 

    Since I have 2 rows on my excel table I want the label to be duplicated two times and fill all %codes% with data from excel.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Solved by creating a monster of a expression 😅

    Spoiler (Highlight to read)
    replace(replace(replace(replace(replace(variables('LabelCode'), '%code1%', items('InitializeReplacements')?['ITEM_CODE']), '%code2%', items('InitializeReplacements')?['CUSTOMER_ITEM_CODE']), '%code3%', body('Convert_time_zone')), '%code4%', items('InitializeReplacements')?['QTY']), '%code5%', items('InitializeReplacements')?['ITEM_CODE_DESCRIPTION'])
    replace(replace(replace(replace(replace(variables('LabelCode'), '%code1%', items('InitializeReplacements')?['ITEM_CODE']), '%code2%', items('InitializeReplacements')?['CUSTOMER_ITEM_CODE']), '%code3%', body('Convert_time_zone')), '%code4%', items('InitializeReplacements')?['QTY']), '%code5%', items('InitializeReplacements')?['ITEM_CODE_DESCRIPTION'])

    Result:

    CristianF_0-1616505503065.png

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 976

#2
Valantis Profile Picture

Valantis 863

#3
Haque Profile Picture

Haque 547

Last 30 days Overall leaderboard