web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Custom formatted table...
Power Automate
Answered

Custom formatted table into an email from PowerBI query

(1) ShareShare
ReportReport
Posted on by 14

Hello,

I have not been able to find an answer for this particular scenario. My end goal is an email with a color-coded table based on certain values in the table. Example below.

I have a PowerBI query that returns a table. I want to color code based on conditional formatting for certain values and send this in an email. My current process runs through a list of departments to run the query and email to each. Set variable (department), run a query against a dataset, select to format the columns, create html table from select output, compose using basic html for borders and background color then if the table is not empty, send an email.

Using compose doesn't allow custom coloring based on columns since its pulling Output from Select.

I have attempted to remove Create HTML table step and do compose based off Select output, but it didn't return a table at all.

I attempted Initialize variable type string, append to string variable using <td data-tag="green"> and output of Select but this didn't return a table at all.

I am new to HTML, JSON etc. and am stuck. Has anyone had success with this?

Current flow:

Current process.jpg

Goal result:

Goal result.png

Categories:
I have the same question (0)
  • Verified answer
    Analyst4Ever Profile Picture
    14 on at

    Hello, I am replying to myself in hopes to help someone else looking for this solution. After no feedback from forums, using YouTube tutorials, other similar solutions on forums and weeks of trial and error, I have found the solution to create color coded table into email using PowerBI data.

    First step is Select from First table rows of Run a query against a dataset. Map "html" to the html table code. Creating a color code with the HEX value of the desired color in the PowerQuery to bring in as value. Power Automate only allowed the format "bgcolor =" and "font color" unlike I found online suggesting "background:". This format did not work.

    Next is Select again From Output map to "item()?['html']" to convert to only the html code and not a two columned table.

    Next is Compose to contain desired styling of the table as well as the column headers

    Last snip is an example of the table as viewed in the Outlook email.

    Analyst4Ever_1-1716921381795.png

    Analyst4Ever_2-1716921611189.png

    Analyst4Ever_3-1716921701555.png

    Analyst4Ever_4-1716921744281.png

     

    Analyst4Ever_5-1716921965072.png

     

  • Tsujin Profile Picture
    6 on at

    Bringing in the Hex code as a value from the power query to be used in the HTML code is genius. Now I can use conditional formatting in my power automate generated emails! Thank you.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard