cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JonL_srft
Frequent Visitor

Format Data Table in Power Automate Desktop to include in email body

Hi

 

I have a simple result from a SQL query in PAD stored as a Data Table in the variable QueryResult.  This is what the data looks like.

 

Reuslt.jpg

I want to be able to format this into the body of an email (without the # row identifer) so just columns Pathway and Tot.  What is the best way of formatting and manipulating this so I can insert into the body of an email?

 

Any advice would be welcome.

 

Thank you.

 

Jon

2 REPLIES 2
VJR
Super User
Super User

Hi @JonL_srft 

 

You can loop through the datatable, pick only the values of Pathway and Tot columns and form the HTML table tags as per your requirement.

 

For example:

 

The below html..

 

 

 

<!DOCTYPE html>
<html>
<body>

<h2>Below are the required details</h2>

<table border=1>
  <tr>
    <th width="50%">Pathway</th>
    <th width="30%">Tot</th>    
  </tr>
  <tr>
    <td></td>
    <td>08</td>
  </tr>
  <tr>
    <td>P0</td>
    <td>27</td>
  </tr>
  <tr>
    <td>P1</td>
    <td>30</td>
  </tr>
</table>


</body>
</html>

 

 

Will give you the output as below..

 

VJR_0-1640949890683.png

 

You can add centre alignment tags etc.

 

Taking the above syntax, during the loop you need to form the string as follows

 

<td>%CurrentLoopValueHere%</td>

 

 

Once you have the html string use it to send it in the body section while sending the email.

 

JonL_srft
Frequent Visitor

That's great thank you!  I will give this a try.

 

Jon

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,396)