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