How to send an email with HTML table in Power Automate

Do you have the following requirements?

  • You want create a HTML table in Power Automate from JSON data
  • You want to send an email with HTML table in the body of the email using Power Automate

If you have these requirements and you are wondering on how to accomplish the same, you are on the right blog. And also it’s quite frequent requirement for customers. So let’s see on how we can accomplish the same.

I am going to make this example little more realistic. I am going to get the list of accounts from CDS, create a HTML table out of it and send it over an email. So let’s see the flow.

I use a Manual trigger and then I use the Common Data Service (current environment) connector and the List Records action to fetch all the accounts in the system. Observe I am just fetching three fields here – Account Name, Account Number, Industry. While the first two are text fields, the third one is an option set.

For the next action, I selected the “Select” data operation. While I could have just used the output from List Records step, the Select action allow me to perform some data massaging on top of output from the previous step. Also if you have some derived columns to create in the array, the select operation might be the one to help you out.

Since IndustryCode is an optionset field, I have used an expression to get the Optionset text instead of value.

item()?['industrycode@OData.Community.Display.V1.FormattedValue']	

With that being done, it’s now time to drawn the final weapon out of armory which is the “Create HTML Table” action. The action have two options to map the columns, one is automatic and the other custom. If you want your header names in the HTML table different from the property names in data, you would need to use the Custom option for columns. For me it’s pretty straightforward. So I go ahead with the automatic mapping.

As a final step, I send out an email with the body set to the output of Create HTML table action.

Below is the sample output of an email I received.

Not the greatest of design but surely something quick and which may result in saving of lot of time.

Hope this helped!

You may also like the below posts.

Debajit Dutta
Business Solutions MVP