Hi @Chooloo,
Glad to hear that it worked for one column! I ran some tests from here and, although it is possible to implement this logic to multiple columns with a series of Composes, the flow becomes confusing and can lead to some errors. I made a few changes to try to keep it simpler, please check if it works for you.
I'm first adding an extra property to our sample data:
Then, right after the Create HTML table action, I'm initializing a variable of type string and passing the HTML table as input:
Then I'm creating a compose to store an array containing the name of the columns that you want to style. In my case, it is just name, age and department. You can also see the flow structure so far on the right:
Next, we will loop our compose that contains the array of headers with an Apply to each:
Inside the Apply to each, there are two Composes: one for storing the original tag, and other for the styled tag. The content of these composes looks like this, where we're passing the header's name as dynamic content corresponding to the Current item property from Apply to each. As a result, for each iteration of the loop, these tags will be populated with the respective column header:
Then we have one more Compose, at this time to apply the replace function, just like we did for the single column. Instead of passing the Create HTML table output as first argument, pass the variable (in red). For the second argument, instead of hardcoding it, use the original tag Compose (in blue). For the third one, you can use the styled tag Compose, similarly to what we did for the single column (in green):
As a last step inside the loop, assign the value of this "replace compose" to the table's variable:
Finally, use the table's variable (and not the Create HTML table output) in your email body:
This is the final output:
Let me know if it works for you or if you need any additional help!
If this is the answer to your question, please mark the post as
Accepted Answer.
If this answer helps you in any way, please give it a
like.
Check more Power Platform content on my
website.
Lets connect on
LinkedIn.