Email Tables Made Easy with Power Automate

Data can be presented in various formats, such as images, graphs, or tables. Since data is a valuable asset for any organization, it is crucial to ensure the audience can easily comprehend it

I had an assignment in Power Automate where the data from the Business event should be extracted , formatted in a tabular column and email the same.

In this post, I will demo the technique to convert the data in String sent as a table via Email.

Initialize a variable with your string.

Declare another variable of type ‘array’ and using split function , create substrings for each line.

split(variables('inputVariable'), decodeUriComponent('%0A'))

Output of the step will create an array

Declare a new array variable . Using For-loop, read the contents of the above array and append the contents to the new array variable as a Attribute-Value pair.

This is achieved using Append to Array variable.

trim(first(split(item(), ':')))
trim(replace(item(), concat(first(split(item(), ':')), ':'), ''))

Next step is creating an HTML table and setting the Columns as automatic.

It is also possible to choose the columns

variables('ReadSplit')[0]['Value']
variables('ReadSplit')[1]['Value']
variables('ReadSplit')[2]['Value']

The output of the HTML table generates a table without proper format.

In order to decorate with border, use a compose function and add the below css

<style>
Table {
  font-family: Arial, Helvetica, sans-serif;
  background-color: #EEEEEE;
  border-collapse: collapse;
  width: 100%;
}

Table td, Table th {
  border: 1px solid #ddd;
  padding: 3px 3px;
}

Table th {
  font-size: 15px;
  font-weight: bold;
  padding-top: 12px;
  padding-bottom: 12px;
  text-align: left;
  background-color: #1C6EA4;
  color: white;
}
</style>

In the ‘Send an Email’ action, add the output of ‘Compose’ and output of ‘HTML’

Save and Run the flow. After executing the flow, you will receive an email as below.

Original Post https://anithasantosh.wordpress.com/2025/01/08/email-tables-made-easy-with-power-automate/

0 Votes: 0 Upvotes, 0 Downvotes (0 Points)

Leave a reply

Follow
Sign In/Sign Up Sidebar Search
Popular Now
Loading

Signing-in 3 seconds...

Signing-up 3 seconds...