“Can I invert the HTML table created by Power Automate flow, to have header in the first column and data next to it?”
When you create an HTML table in Power Automate, it has always the same layout. The column names are at the top, in the first row, and all items on the following rows. It’s the standard layout everyone is used to e.g. from Excel tables. But what if you’re not happy about it? If you’d like to invert the table, to have the data in columns instead of rows? How would you do it in Power Automate?
Use ChatGPT to do it for you
Inverting an HTML table is not an easy task as there’re so many things to process. While it might be doable using some complex combination of split(…) and many other expressions, there’s one much easier approach. Instead of doing the inversion by yourself, you can use ChatGPT to do it for you!
In the previous post I explained how to access ChatGPT from a flow and how to use it to process Teams attendance report. This time you can use it to invert an html table.
Start by getting all the items for the table and create it with the ‘Create HTML table’ action.
Follow with a ‘Compose’ action where you explain the AI what you’d like to do, e.g.
Please invert the html table below. Move the header from the first row to the first column, turn all the data rows into columns and remove the header.
@{body('Create_HTML_table')}
And sent he request to ChatGPT as explained in the article dedicated to ChatGPT.
Extract the response with an expression…
body('HTTP')?['choices'][0]?['message']?['content']
…and send the inverted table in an email.
Summary
As you can see in this example, if you learn to use AI in your flows, you can do so much more with much less work.
A dedicated Power Automate flow that’d invert an HTML table would be very complex and would take a lot of time to build, not to mention the necessary skills and knowledge. On the other side, writing a request to ChatGPT doesn’t take very long and everyone can do it. That’s why you should add this approach to your toolkit. Even though it’s not a solution to every problem and has some additional costs, sometimes it’s worth it to delegate work to AI.
Why not use the AI to build you that transpose process via Powe Automate Co-pilot 😛
As always, excellent article.