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 / HELP! How do I convert...
Power Automate
Unanswered

HELP! How do I convert an array into a one-column HTML Table?

(0) ShareShare
ReportReport
Posted on by

I have an array variable that stores contents as follows:

 

[
"A",
"B",
"C",
"D"
]

 

How do I convert this into a usable HTML table with a column header of "Item"? The result would look like the following:

Item
A
B
C
D

 

Categories:
I have the same question (0)
  • ChristianAbata Profile Picture
    8,951 Most Valuable Professional on at

    hi @Anonymous  what you need to do that is convert the array in a valid format for example you need an array like this:

     

    values.PNG

     

    to get this result

     

    pasrt2.PNG

  • Community Power Platform Member Profile Picture
    on at
    How do I go about converting the array provided so that there are headers at the start? The array I listed is the result of an apply to each that loops over a SharePoint list, so I can’t figure out how to get the headers in place.
  • ChristianAbata Profile Picture
    8,951 Most Valuable Professional on at

    @Anonymousyou need to convert you array output into string like this string('HERE YOUR OUTPUT') then you can format every part of your array if is static you can use the next expresions in a separeted compose actions.

    To letter A

     

     

    concat(replace(split(outputs('ToString'),'","')[0],'[','{"values": '),'"}')

     

     

    Letter B

     

     

    concat('{"values": "',split(outputs('ToString'),'","')[1],'"}')

     

     

    To letter C

     

     

    concat('{"values": "',split(outputs('ToString'),'","')[2],'"}')

     

     

    To letter D

     

     

    concat('{"values": "',replace(split(outputs('ToString'),'","')[3],']','}'))

     

     

    Then just add all the composes into you table action following the example a give you.

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    If your array length is fixed you could do the following way.

     

    image.png

     

    Above the header expression is as follows:

    variables('test')[0]
    variables('test')[1]
    variables('test')[2]
    variables('test')[3]
     
    Test Result:
    image.png
  • v-litu-msft Profile Picture
    on at

    Hi @Anonymous,

     

    Just like @ChristianAbata 's advice, before creating an HTML table, you should create convert the array convert into JSON, and I have a simple method could help you:

    1. Put the array into an array variable.
    2. Initialize an array variable named JSONArray.
    3. Create Apply to each action, then Append to array variable to put the A, B, C, D into the JSON.
    4. Create HTML table.

    Annotation 2020-02-26 123465.png

     

    Annotation 2020-02-26 123466.png

     Run result:

    Annotation 2020-02-26 123467.png

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Community Power Platform Member Profile Picture
    on at

    @v-litu-msft, this is definitely the solution. Any chance you have a recommendation for how I could then drop that into a Teams message using the Post Message as Flow bot to user action? I got a message, but it shows like this:

     

    Value A B C
     
    Is there any way to force this to show as rows in Teams?
     
     
  • v-litu-msft Profile Picture
    on at

    Hi @Anonymous,

     

    Sure, you could use this action:

    Annotation 2020-02-27 164257.png

     The message in the MS teams:

    Annotation 2020-02-27 164258.png

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Community Power Platform Member Profile Picture
    on at

    @v-litu-msft That's what I thought. This is what I am now getting, however:

    <table><thead><tr><th>Value</th></tr></thead><tbody><tr><td>A</td></tr><tr><td>B</td></tr><tr><td>C</td></tbody></table>
     
    I wonder why?
     
    My action step has the output of the HTML table that used the JSONArray we built.
  • v-litu-msft Profile Picture
    on at

    Hi @Anonymous ,

     

    Sorry for late, <table><thead><tr><th>Value</th></tr></thead><tbody><tr><td>A</td></tr><tr><td>B</td></tr><tr><td>C</td></tbody></table> is the code of the HTML table? How do you get this format text? you could share screenshot of the run result.

    And If your problem has been solved, You could go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

    Best Regards,
    Community Support Team _ Lin Tu

  • Community Power Platform Member Profile Picture
    on at

    @v-litu-msft The values I am pulling are being created from an "Apply to each" loop for a SharePoint list:

     

    ApplytoEach for List.png

     

    Then, I do the steps we discussed regarding appending to an array, converting to table, and posting in Teams:

     

    Output to Teams.png

     

    This is the result in Teams:

     

    Teams Result.png

     

     

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