How to Create HTML Table in Power Automate + Formatting

Recently, I was working on a project where I was required to create an HTML table in Power Automate. Also, I needed to work on Power Automate HTML table formatting [Like table header font will be bold and different color].

In this Power Automate article, I will tell you how to create HTML table in Power Automate from SharePoint list, Power Automate style HTML table with an example.

Power Automate Create HTML Table from SharePoint List

To create an HTML table in Power Automate from the SharePoint list, check out the below steps:

Scenario:

To explain this example, I have taken one of my SharePoint lists [Project Management Team] with a couple of columns, as look at below:

Power Automate create html table from SharePoint list

Requirement:

My requirement is to send an email of Project details with the Project status value Completed and Rejected. For that, I will create an HTML table in Power Automate.

Go through the below-mentioned points:

1. Open the Power Automate Home page and click + Create. Select Instant Cloud flow. Give the flow a name and select trigger Manually trigger a flow. Tap Create.

2. Then, add the ‘Get items’ flow action under the trigger. Power Automate ‘Get items’ flow action retrieves all items from a SharePoint list. Set the below details:

  • Site address: Select a specific site address from the drop-down.
  • List Name: Select a specific list from the drop-down.
  • Filter Query: Provide the condition as placed below code:
ProjectStatus eq 'Completed' or ProjectStatus eq 'Rejected'

Where ‘eq’ means the ‘equals to’ operator in a Power Automate filter query syntax. (ProjectStatus: Internal Name of a Field).

Create html table Power Automate

3. Add the ‘Create HTML table’ flow action to present data in table format and set the required fields.

  • From: Here, I have selected the value of the Get items’ output from dynamic content.

Click Show all to display all the advanced parameters.

  • Columns: Select Custom column from the drop-down options.
HeaderValue
Project Title
Project Assigned To
Project Start Date
Project Status
Project Deadline
Select value from the dynamic content under Get items and expression
Power Automate create html table

4. After that, select a Compose flow action to format the HTML table by adding CSS code.

Set the required parameters below:

  • Inputs: Insert the below given code.
replace(body('Create_HTML_table'),'<table>','<table border="4">')
Create html table in Power Automate from SharePoint list

5. To send an email, click on the next step and select the Send an Email (V2) (Outlook) action.

Configure the below properties:

  • To: Enter the email in a custom manner manually.
  • Subject: Provide subject line for the mail
  • Body: Include the outputs of the compose flow action.
Power Automate create html table custom columns

6. Once the flow is ready, Click on Save. Then, select Test -> In the Test flow window, Click Manually -> Select Done.

Result:

Once your flow runs successfully, you can check your Outlook email. It will receive the Project details in a tabular format – Project Status [Completed/Rejected].

You can refer to the image below:

Power Automate send email with table from SharePoint list

This is all about how to send an email with an HTML table from the SharePoint list using Power Automate.

Power Automate HTML Table Formatting

To create and format the HTML table, follow the below-mentioned steps:

1. Create a Power Automate Instant cloud flow. Inside the trigger, add the below parameters:

  • Task Name: Text Input
  • Task Start Date: Date Input
  • Task Status: Text Input
  • Email: Email Input
How to create html table in Power Automate

2. Next, add the ‘Compose’ flow action to provide the CSS code, set the expression to provide the borders, and create an HTML table.

<table style="border-collapse: collapse; width: 100%; border: 2px solid #4CAF50; margin: 20px;">
    <thead>
        <tr style="background-color: #4CAF50; color:black;">
            <th style="border: 2px solid #4CAF50; padding: 12px;">Task Name</th>
            <th style="border: 2px solid #4CAF50; padding: 12px;">Task Start Date</th>
            <th style="border: 2px solid #4CAF50; padding: 12px;">Task Status</th>
        </tr>
    </thead>
    <tbody>
        <tr style="background-color: #f2f2f2;">
            <td style="border: 2px solid #4CAF50; padding: 12px;">Create a SharePoint list</td>
            <td style="border: 2px solid #4CAF50; padding: 12px;">05/04/024</td>
            <td style="border: 2px solid #4CAF50; padding: 12px;">Completed</td>
        </tr>
        <tr>
            <td style="border: 2px solid #4CAF50; padding: 12px;">@{triggerBody()?['text']}</td>
            <td style="border: 2px solid #4CAF50; padding: 12px;">@{triggerBody()?['date']}</td>
            <td style="border: 2px solid #4CAF50; padding: 12px;">@{triggerBody()?['text_1']}</td>
        </tr>
    </tbody>
</table>

Replace Task Name, Task Start Date, and Task Status from dynamic content.

Format html table Power Automate

3. Then, add the ‘Send an email(V2)’ flow action to send an email consisting of the HTML table with borders. Set all the details.

  • To: Provide the user email to whom you want to send email.
  • Subject: Enter the purpose of that email.
  • Body: I have given the Outputs of the Compose flow action here.
Power Automate html table formatting

Then, save and run the flow manually.

4. In the Runflow window, provide the required details and Click on the Runflow button.

Power Automate format html table

Outputs:

You can see the below image displaying the table in a customized format.

Power Automate style html table

Also, you may like:

Conclusion

I hope this Power Automate tutorial helps you understand how to create an HTML table from a SharePoint list and format the table using Power Automate.

  • >

    Build a High-Performance Project Management Site in SharePoint Online

    User registration Power Apps canvas app

    DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

    Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

    Power Platform Tutorial FREE PDF Download

    FREE Power Platform Tutorial PDF

    Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…