cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
saiemandi
Regular Visitor

Send Email with Excel Cell values after formatting numbers

I have created a simple flow which will perform below actions:

 

List Rows Present in a table -> Create HTML Table -> HTML table Styling -> Send Email with HTML table

 

My Excel table consists of some calculations and I have formatted the cell values as needed. (% values as Percentage, decimal places to required decimal values etc).

 

When List Rows Present in a table executed, it returns values without any formatting. For example:

 

cell value: 75% -> Returned as 0.75

cell value: 36.89 -> Returned as 36.8888888888889

cell value: 32.49 -> Returned as 32.4888888888889

cell value: 16.16% -> Retuned as 0.161616161616162

 

I can get all the column values from List rows present in table but not sure how to re-format the values and send email with appropriate figures. Any help or suggestion here?

 

Here is my flow:

 

saiemandi_0-1635354076540.png

 

Appreciated your help.

1 ACCEPTED SOLUTION

Accepted Solutions
ekarim2020
Community Champion
Community Champion

We can take an Excel file, read and format the content as a HTML table:

2021-10-27_19-05-48.png

Each column of the Excel data will be read and returned to us as a string. For example 74.91 will be returned as  "74.91". This means that we will need to convert the text into a number before we can format it as either a percentage or a floating point number. We can use the formatNumber function to format the number into a Percentage or Floating Point number using Standard Format Specifiers (eg. P0 for percentage with no decimal point) tell it how to display the output produced.

 

Here is an example of a row of data that is actually read from the Excel file:


"Percentage1": "0.59365695249913",
"Data 1": "6.03988297605158",
"Data 2": "18.9339464855052",
"Percentage2": "0.0827403679605414"

We can use the Select operation to format each row of data after it has been read from Excel:

2021-10-27_19-23-54.png

These are expressions. Note how the item()?[ ] matches the Excel column names:

 

formatNumber(float(item()?['Percentage1']),'P0','en-us')
formatNumber(float(item()?['Data 2']),'F2','en-us')
formatNumber(float(item()?['Percentage2']),'P2','en-us')
formatNumber(float(item()?['Data 1']),'F2','en-us')

 

ekarim2020_2-1635360205070.png

ekarim2020_0-1635359699066.png

This is the table formatting code which you can copy and paste. I'll add this code below.

2021-10-27_19-36-03.png

2021-10-27_19-37-57.png

This is the Table formatting code:

 

<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>

 


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

 

View solution in original post

2 REPLIES 2
ekarim2020
Community Champion
Community Champion

We can take an Excel file, read and format the content as a HTML table:

2021-10-27_19-05-48.png

Each column of the Excel data will be read and returned to us as a string. For example 74.91 will be returned as  "74.91". This means that we will need to convert the text into a number before we can format it as either a percentage or a floating point number. We can use the formatNumber function to format the number into a Percentage or Floating Point number using Standard Format Specifiers (eg. P0 for percentage with no decimal point) tell it how to display the output produced.

 

Here is an example of a row of data that is actually read from the Excel file:


"Percentage1": "0.59365695249913",
"Data 1": "6.03988297605158",
"Data 2": "18.9339464855052",
"Percentage2": "0.0827403679605414"

We can use the Select operation to format each row of data after it has been read from Excel:

2021-10-27_19-23-54.png

These are expressions. Note how the item()?[ ] matches the Excel column names:

 

formatNumber(float(item()?['Percentage1']),'P0','en-us')
formatNumber(float(item()?['Data 2']),'F2','en-us')
formatNumber(float(item()?['Percentage2']),'P2','en-us')
formatNumber(float(item()?['Data 1']),'F2','en-us')

 

ekarim2020_2-1635360205070.png

ekarim2020_0-1635359699066.png

This is the table formatting code which you can copy and paste. I'll add this code below.

2021-10-27_19-36-03.png

2021-10-27_19-37-57.png

This is the Table formatting code:

 

<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>

 


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

 

View solution in original post

saiemandi
Regular Visitor

Thank you @ekarim2020 

 

It helped me to achieve my requirement.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (2,279)