How to Email an Excel table using Power Automate

Summary of the flow

Using Power Automate we can read a table in an Excel file like the one below:

then select the columns from the table we want to display and then send a nicely formatted HTML table using Outlook:

a nicely formatted HTML table in an  email message

This is the flow.

Flow actions: List rows in the excel file.

If your Excel table contain dates be sure to set the DateTime format to ISO 8601:

Set DateTime format to ISO 8601

If you don’t set DateTime format to ISO 8601 your dates will appear as integer dates:

If you don't set DateTime format to ISO 8601 your dates will appear as integer dates

The Select action is used to select the columns that we want to display in our HTML table.

The Select action is used to select the columns that we want to display in our HTML table.

The output of the Select action is used to create the HTML table.

The output of the Select action is used to create the HTML table.

This is the table formatting style code I used. I have provided the code below which you can copy-and-paste into your flow.

table formatting style code

Here is the code that you can copy-and-paste for the Compose Table Formatting Style action:

<style>
     table {
          border: 1px solid #1C6EA4;
          background-color: #EEEEEE;
          width: 100%;
          text-align: left;
          border-collapse: collapse;
          table-layout: auto;
     }

     table td,
     table th {
          border: 1px solid #AAAAAA;
          padding: 10px;
     }

     table tbody td {
          font-size: 13px;
     }

     table thead {
          background: #1C6EA4;
          border-bottom: 2px solid #444444;
     }

     table thead th {
          font-size: 15px;
          font-weight: bold;
          text-align: left;
          color: #FFFFFF;
          border-left: 2px solid #D0E4F5;
     }

     table thead th:first-child {
          border-left: none;
     }
</style>

This is the Send an email action:

 Send an email action

Here is a detailed view of the Send an email action. Pay attention to the order of the Compose outputs in the email body or your HTML table styling wont be applied:

This is the email that was sent out:

Notes

 Video: Power Automate flow HTML Table Formatting in Email | Flows & SharePoint by @RezaDorrani 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Website Built with WordPress.com.

Up ↑

%d bloggers like this: