Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

Iterate through excel rows

(0) ShareShare
ReportReport
Posted on by

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 !

 

 

 

  • Community Power Platform Member Profile Picture
    on at
    Re: Iterate through excel rows

    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

     

     

  • Community Power Platform Member Profile Picture
    on at
    Re: Iterate through excel rows

    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.

  • Verified answer
    annajhaveri Profile Picture
    8,531 Most Valuable Professional on at
    Re: Iterate through excel rows

    @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.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,587 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,928 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow