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 / Compose HTML Table wit...
Power Automate
Answered

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. 

Screenshot 2024-02-29 192123.png
Categories:
I have the same question (0)
  • SudeepGhatakNZ Profile Picture
    14,396 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,672 Super User 2026 Season 1 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

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!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 589

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 284 Super User 2026 Season 1

Last 30 days Overall leaderboard