📨How to Email an Excel Table Using Power Automate

In this tutorial, we will learn how to read a table in an Excel file, selectively display specific columns, and then send the resulting data in a nicely formatted HTML table via Outlook. By the end of this post, you will have the ability to extract valuable information from Excel tables and effectively communicate that information to others through clean, professional-looking HTML tables sent via Outlook.

Summary of the flow

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

Excel file with some sample data

… 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. I used a compose action that I renamed to “Compose Table Formatting Style”:

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:

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:

This is the email that was sent out showing the HTML table

Notes

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

2 thoughts on “📨How to Email an Excel Table Using Power Automate

Add yours

  1. Thank you for this tutorial. It is exactly what I need. I am unable to get it to work properly though.

    Firstly for me the formatting doesn’t apply. I don’t have a “Compose Table Formatting Style” option to select. The closest I get is simply “Compose” which I used in lieu of your option.

    Secondly, the date format, while not the numbers as you so kindly sorted out for me, includes the time as well which I don’t want it to do.

    It comes through from the flow as: 2023-06-01T00:00:00.000Z when I would only want 2023-06-01

    Do you have any ideas what I might be doing wrong?

    1. Hi MFoale,

      Thanks for taking the time to comment on my post.

      (1) I used a Compose action which I renamed to “Compose Table Formatting Style”. I have update the post to make this clear.

      (2) You can use the formatDateTime function to format your dates. The following expression will return 2023-06-01

      formatDateTime(‘2023-06-01T00:00:00.000Z’, ‘yyyy-MM-dd’)

      Best wishes,

      Ellis

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 )

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: