cancel
Showing results for
Did you mean:
Anonymous
Not applicable

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

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

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

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:

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')``````

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

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;
}
table tbody td {
font-size: 13px;
}
background: #1C6EA4;
border-bottom: 2px solid #444444;
}
font-size: 15px;
font-weight: bold;
text-align: left;
color: #FFFFFF;
border-left: 2px solid #D0E4F5;
}
border-left: none;
}
</style>``````

Ellis
____________________________________
If you like my response, please give it a Thumbs Up.

2 REPLIES 2
Super User

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

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:

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')``````

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

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;
}
table tbody td {
font-size: 13px;
}
background: #1C6EA4;
border-bottom: 2px solid #444444;
}
font-size: 15px;
font-weight: bold;
text-align: left;
color: #FFFFFF;
border-left: 2px solid #D0E4F5;
}
border-left: none;
}
</style>``````

Ellis
____________________________________
If you like my response, please give it a Thumbs Up.

Anonymous
Not applicable

Thank you @ekarim2020

It helped me to achieve my requirement.

Announcements

#### Celebrating the May Super User of the Month: Laurens Martens

@LaurensM  is an exceptional contributor to the Power Platform Community. Super Users like Laurens inspire others through their example, encouragement, and active participation. We are excited to celebrated Laurens as our Super User of the Month for May 2024.   Consistent Engagement:  He consistently engages with the community by answering forum questions, sharing insights, and providing solutions. Laurens dedication helps other users find answers and overcome challenges.   Community Expertise: As a Super User, Laurens plays a crucial role in maintaining a knowledge sharing environment. Always ensuring a positive experience for everyone.   Leadership: He shares valuable insights on community growth, engagement, and future trends. Their contributions help shape the Power Platform Community.   Congratulations, Laurens Martens, for your outstanding work! Keep inspiring others and making a difference in the community!   Keep up the fantastic work!

#### Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!