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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Compose HTML Table wit...
Power Automate
Unanswered

Compose HTML Table with 02 columns only. Column -1: Header list; Column -2: Value

(0) ShareShare
ReportReport
Posted on by 24

Need help:  the default Compose HTML table is creating a horizontal table of two rows with 'n' number of columns. This makes the user to scroll left to right when the data fields are more. 

How can the HTML table be composed with 2 columns and 'n' number of rows. 

 

May be the CSS used by me is not appropriate. Refer the screenshot for more illustration. 

Categories:
I have the same question (0)
  • SudeepGhatakNZ Profile Picture
    14,394 Most Valuable Professional on at

    Can you send me the output of Get items?

    Will the table always have a single row?

     

  • sudhansu2050 Profile Picture
    24 on at

    The flow structure and HTML table:

     

    sudhansu2050_1-1709298671789.png

     

     

    Output of Create HTML table: 

    {
        "body""<table><thead><tr><th>Request Created By</th><th>Type of Work</th><th>Priority</th></tr></thead><tbody><tr><td>Sudhansu Choudhury</td><td>Building Painting</td><td>Low</td></tr></tbody></table>"
    }
    sudhansu2050_0-1709298616718.png

     

    Output Compose HTML Table:

    "<style>\n\ntable, td, th {  \n\n  border: 1px solid #ddd;\n\n  text-align: left;\n\n}\n \ntable {\n\n  border-collapse: collapse;\n\n  width: 100%;\n\n}\n \nth, td {\n\n  padding: 15px;\n\n}\n\n</style>\n\n\n\n\n<p><table><thead><tr><th>Request Created By</th><th>Type of Work</th><th>Priority</th></tr></thead><tbody><tr><td>Sudhansu Choudhury</td><td>Building Painting</td><td>Low</td></tr></tbody></table></p>"
  • Verified answer
    Chriddle Profile Picture
    8,436 Super User 2025 Season 2 on at

    You have to restructure your data.

    Since the output of a "Create HTML table" is also XML, you can use xpath with it:

    Chriddle_0-1709303880403.png

    Compose

    <table>
     <thead>
     <tr>
     <th>Request Created By</th>
     <th>Type of Work</th>
     <th>Priority</th>
     </tr>
     </thead>
     <tbody>
     <tr>
     <td>Sudhansu Choudhury</td>
     <td>Building Painting</td>
     <td>Low</td>
     </tr>
     </tbody>
    </table>

     

    Select

    From

    range(
    	0,
    	length(
    		xpath(
    			xml(outputs('Compose')),
    			'//thead/tr/th'
    		)
    	)
    )

    Map Key

    xpath(
    	xml(outputs('Compose')),
    	'//thead/tr/th/text()'
    )[item()]

    Map Value

     

    first(
    	xpath(
    		xml(outputs('Compose')),
    		concat('//tbody/tr/td[', add(1, item()), ']/text()')
    	)
    )

     

    Chriddle_1-1709304046365.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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard