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 / Formatting HTML Table ...
Power Automate
Answered

Formatting HTML Table with Compose

(0) ShareShare
ReportReport
Posted on by 40

Hi all, 

 

I'm using Power Automate to send some tables through email from PBI. My table has 4 columns and I would like to format third column to comma style and last column to percentage:

 

AlineStoll_0-1645816522957.png

 

I'm using the compose with the following code:

 

<style>
table {
border: 1px solid #1C6EA4;
background-color: #EEEEEE;
width: 100%;
text-align: left;
border-collapse: collapse;
}
table td, table th {
border: 1px solid #AAAAAA;
padding: 3px 2px;
}
table tbody td {
font-size: 13px;
}
table thead {
background: #DC0000;
border-bottom: 2px solid #444444;
}
table thead th {
font-size: 15px;
font-weight: bold;
color: #FFFFFF;
border-left: 2px solid #D0E4F5;
}
table thead th:first-child {
border-left: none;
}
</style>

 

Could someone please help me with it? I'm new in Power Automate and I am totally lost 😞

Categories:
I have the same question (0)
  • Mister_Shaik Profile Picture
    1,008 on at

    Hi @AlineStoll ,

     

    I'm assuming that you're passing your values to the compose action to build the table rows and append to a string or variable, in that case you a formatNumber expression to get your desired output.

     

    • Thousands separator or comma formatting:- formatNumber(#ValueHere, '###,###,###.##')
    • Percentage: formatNumber(#ValueHere, '00.00%')

    Below is an example input and the result,

    formatNumber(96845325, '###,###,###.##')96,845,325
    formatNumber(0.685523, '###,###,###.##')68.55

     

    You can refer below blog for a detailed guide on how this works and different ways of formatting,
    https://mistershaik.com/number-formatting-in-power-automate-and-power-apps/ 

     

    Hope this helps 🙂


    Kind Regards,

    Shaik Sha
    ________________________________________________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

  • Verified answer
    AlineStoll Profile Picture
    40 on at

    Hi Shaik, 

     

    Thank you very much for your help, but I was not successful doing it. 

    I am extracting my data from Power BI, maybe I am not doing something correct, let me explain to you my step to step:

     

    Step 1: From PBI, I initialize a row number variable

     

    AlineStoll_0-1646013462193.png

    Step 2: I initialized an HTML table

     

    AlineStoll_1-1646013514518.png

    Step 3: I append to string variable

     

    AlineStoll_2-1646013551442.png

     

    Step 4: I format number

     

    AlineStoll_3-1646013591859.png

     

     

    Step 5: I sent to email

     

    AlineStoll_4-1646013613249.png

     

     

    When I save show no errors, but when I run, the email is not sent to me. Could you please help me?

     

    Thank you

     

     

  • AlineStoll Profile Picture
    40 on at

    Maybe, I am doing the append to the HTML table incorrectly. Do you know how should I do it from PBI?

     

  • AlineStoll Profile Picture
    40 on at

    Actually, now I am running and shows the following message: 

    AlineStoll_5-1646013912374.png

     

  • AlineStoll Profile Picture
    40 on at
    {
      "type""object",
      "properties": {
        "rows": {
          "type""array",
          "items": {
            "type""object",
            "properties": {
              "entity": {
                "type""object",
                "properties": {
                  "Power BI values": {
                    "title""Power BI data",
                    "type""array",
                    "items": {
                      "type""object",
                      "properties": {
                        "SalesRep": {
                          "title""Power BI data SalesRep",
                          "type""string"
                        },
                        "MTD Bids #": {
                          "title""Power BI data MTD Bids #",
                          "type""number"
                        },
                        "MTD Bids $": {
                          "title""Power BI data MTD Bids $",
                          "type""number"
                        },
                        "MTD Bids C1": {
                          "title""Power BI data MTD Bids C1",
                          "type""number"
                        }
                      },
                      "required": []
                    }
                  }
                },
                "required": [
                  "Power BI values"
                ]
              }
            },
            "required": [
              "entity"
            ]
          }
        }
      },
      "required": [
        "rows"
      ]
    }
     
    AlineStoll_6-1646014072765.png

     

  • Verified answer
    Mister_Shaik Profile Picture
    1,008 on at

    Hi @AlineStoll ,

     

    You need to do the number formatting inside the "Append to string variable" action, on the number fields that you have.

     

    2. formatNumber.PNG

    If you're planning to convert the "MTD Bids $" to a thousands separator format (e.g., $ 123,456,789.12), then the formula would look something like this,

     

    formatNumber(items('Apply_to_each')?['MTD Bids $'],'$ ###,###,###.##')

     

     

    You can change the expression based on the inputs and the format you want.

     

    Also, if you're planning to send large amounts of emails every day, then I'd suggest you to use the Outlook send email action rather than the Mail connector, as it has low threshold for throttling, below is the throttling limits for Mail actions,

    1. throttling limits.PNG

     

    Kind Regards,

    Shaik Sha
    ________________________________________________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

  • AlineStoll Profile Picture
    40 on at

    Thank you @Mister_Shaik , helped me a lot. I just have an additional question:

     

    I need to attach three different HTML tables in the same email, but when I create the flow to develop second HTML, when I save it, and apply, when I come back Power Automate delete it. Do you know how can I fix it?

     

    AlineStoll_0-1646748388273.png

     

    When I try to create Table HTML 2, the system deletes it.

     

    Can you please help me? Thank you.

     

     

  • Mister_Shaik Profile Picture
    1,008 on at

    Hi @AlineStoll ,

     

    Can you clarify what you mean by delete?

     

    After you generate the HTML Table - are you saving it to some location or sending it out in the email?

     

    Can you please provide how the second HTML table is coming into picture, as I can only see one table being created in the flow screenshot

     

    Kind Regards,

    Shaik Sha

  • AlineStoll Profile Picture
    40 on at

    Hi @Mister_Shaik ,

     

    I did the following flow, but when I save and run, and come back again to the page, it disappear and I cannot attach the second table. Could you please help me?

     

    AlineStoll_0-1646761824077.png

     

     

    AlineStoll_1-1646761846724.png

     

    AlineStoll_2-1646761868335.png

     

    AlineStoll_3-1646761891029.pngAlineStoll_4-1646761914286.png

     

    AlineStoll_5-1646761939667.png

     

    AlineStoll_6-1646761967640.png

     

     

    AlineStoll_7-1646761990848.png

     

     

    AlineStoll_8-1646762012588.png

     

    AlineStoll_9-1646762031525.png

     

     

     

    AlineStoll_10-1646762063356.png

     

    AlineStoll_11-1646762082838.png

     

     

     

     

     

     

  • AlineStoll Profile Picture
    40 on at

    In reality @Mister_Shaik I don't know how to prepare the second HTML table. Is it correct?

     

    Thanks

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 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard