Skip to main content

Notifications

Power Automate - Building Flows
Answered

Merging 2 or more HTML tables into one in flow

(0) ShareShare
ReportReport
Posted on by 75

Hello, 

 

I have a flow where I I am looping every country to filter array from 2 share point list and creating 2 HTML tables out of it to send it an email. (Flow can be seen below ) . 

 

But I want to merge the 2 HTML table output into one consolidated HTML before using it in Email step. I do not want to send 2 different tables inside a email . Both these HTML table output are having same columns , only difference is the Data.(Example can be seen below ) . 

 

Ideally, I would like to avoid nested loop(Apply to each inside current Apply to each ) if possible. 

Can you let me know of any way I can achieve this ?

 

Thank you 

 

Current flow: 

Sivaperumal31_0-1678411963516.png

 

HTML table output example:

Sivaperumal31_2-1678412208412.png

 

 

 

  • Amirin Profile Picture
    Amirin 128 on at
    Re: Merging 2 or more HTML tables into one in flow

    Hi to the solution giver

    I use your solution,, but my table does not have any grids. can you optimize your code? ^_^

    Amirin_1-1692050551621.png

     

  • Sivaperumal31 Profile Picture
    Sivaperumal31 75 on at
    Re: Merging 2 or more HTML tables into one in flow

    Thank you @v-dezhili-msft , It did the job for me. Appreciate it.

  • Verified answer
    Re: Merging 2 or more HTML tables into one in flow

    Hi @Sivaperumal31 ,

     

    If your two tables have the same format, you can hand-write an HTML table header, and then use the split() formula to cut out the table body and merge them together.

    vdezhilimsft_1-1678428644050.png

     

    vdezhilimsft_0-1678428507615.png

    vdezhilimsft_2-1678428664545.png

    vdezhilimsft_3-1678428702079.png

    vdezhilimsft_4-1678428729045.png

    <table>
    <thead>
    <tr>
    <th>Name</th>
    <th>Grade</th>
    <th>Date</th>
    </tr>
    </thead>
    <tbody>
    @{split(split(body('Create_HTML_table'),'<tbody>')[1],'</tbody>')[0]}
    @{split(split(body('Create_HTML_table_2'),'<tbody>')[1],'</tbody>')[0]}
    </tbody>
    </table>

     

    Best Regards,

    Dezhi

     

     

     

     

     

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard