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 / Create html table from...
Power Automate
Unanswered

Create html table from csv file

(0) ShareShare
ReportReport
Posted on by 78

I am using the step Create File From Paginated Report

which creates a CSV file

the output of the CSV file is as below:

 

{
"statusCode": 200,
"headers": {
"Pragma": "no-cache",
"Transfer-Encoding": "chunked",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Frame-Options": "deny",
"X-Content-Type-Options": "nosniff",
"RequestId": "27bd1808-fc47-457c-b3b6-b91933d08050",
"Access-Control-Expose-Headers": "RequestId",
"Timing-Allow-Origin": "*",
"x-ms-apihub-cached-response": "true",
"x-ms-apihub-obo": "false",
"Cache-Control": "no-store, must-revalidate, no-cache",
"Date": "Wed, 16 Nov 2022 10:26:49 GMT",
"Content-Type": "text/csv",
"Content-Length": "944082"
},
"body": "ClientID,Username,FirstName,Surname,ClientProfile,Channel,Affiliate\r\n0000,0000,xxxx,xxxx,xxxx,xxxxx,xxxxx\r\0000,0000,xxxx,xxxxx,xxxxx,xxxxx\r\n

 

How do I create a HTML table from this CSV output file?

 

Categories:
I have the same question (0)
  • StretchFredrik Profile Picture
    3,395 Super User 2025 Season 2 on at

    Hello!

     

    This thread has a solution that should work in your case too:

     

    Convert .csv file into an HTML table - Power Platform Community (microsoft.com)

  • Sundeep_Malik Profile Picture
    6,484 on at

    Hey @drewbty 

     

    You can use create html table action for this.

    But it only accepts array as input.

    So, do one thing, create a compose action. In that store the above.

    Then make another compose in that write:

    createArray(outputs('Compose'))

    or if you want the headers, you can write createArray(outputs('Compose').headers)

    and if you want only body you can write createArray(outputs('Compose').body)

    And then pass this compose in create html table action.

     

    This is how the flow looks like:

     

    Sundeep_Malik_0-1668596368426.png

     

     

    1st Compose:

    Contains your above data

    Sundeep_Malik_1-1668596399633.png

     

    2nd compose:

    used compose action and used createArray function inside it on headers.

    Sundeep_Malik_2-1668596443228.png

     

    3rd Compose:

    Passed Outputs of compose 2

    Sundeep_Malik_3-1668596474016.png

     

    Output:

     

    Sundeep_Malik_4-1668596508715.png

     

    Or if you want everything in that html action, like headers, body and status code at the same time you will have to go in advance settings of html table action and make the columns manually, other than automatically.

     

    If this was the solution, you were looking for you can accept this as a solution and if you liked the explanation, you can give a thumbs up. 🙂

  • drewbty Profile Picture
    78 on at

    Hi @Sundeep_Malik 

     

    Getting the following error when attempting this.

     

    Do I have to select the columns manually? How do I access each one if so

    drewbty_1-1668599889304.png
    drewbty_0-1668599870339.png

     

  • drewbty Profile Picture
    78 on at

    If just headers are passed in on compose2 I get this 

     

    drewbty_0-1668600351095.png

     

  • Sundeep_Malik Profile Picture
    6,484 on at

    @drewbty 

    I am seeing that orange arrow for the first time.

    @StretchFredrik have you seen the orange arrow before or have any idea about it?

     

    @drewbty I think the problem could be with that Power Bi Action can you expand it in run history and post the screenshot here.

     

    And also post what you have added in that create html action in edit mode.

  • drewbty Profile Picture
    78 on at

    I think it just means that retries occured?

     

    {"statusCode":200,"headers":{"Pragma":"no-cache","Transfer-Encoding":"chunked","Strict-Transport-Security":"max-age=31536000; includeSubDomains","X-Frame-Options":"deny","X-Content-Type-Options":"nosniff","RequestId":"4d4336f9-8172-4dbe-81c8-dcd2763f5e49","Access-Control-Expose-Headers":"RequestId","Timing-Allow-Origin":"*","x-ms-apihub-cached-response":"true","x-ms-apihub-obo":"false","Cache-Control":"no-store, must-revalidate, no-cache","Date":"Wed, 16 Nov 2022 11:57:22 GMT","Content-Type":"text/csv","Content-Length":"944082"},"body":"ClientID,Username,FirstName,Surname,ClientProfile,Channel,Affiliate\r\nxxxxx,xxxx,xxxx,xxxx,xxxxx\r\n

     

     

    I've attached a sample of this first line of output here , and the screenshot below

     

    drewbty_1-1668600599169.png

     

  • grantjenkins Profile Picture
    11,063 Moderator on at

    What was the final output you were expecting to see?

     

    Also, do you have the full JSON as the current JSON you posted isn't complete/valid. There is a missing n after \r\, and there should be 7 columns of data, but the second row only contains 6.

    "ClientID,Username,FirstName,Surname,ClientProfile,Channel,Affiliate\r\n0000,0000,xxxx,xxxx,xxxx,xxxxx,xxxxx\r\0000,0000,xxxx,xxxxx,xxxxx,xxxxx\r\n

     

    And lastly, will the fields be the same every time? (ClientID,Username,FirstName,Surname,ClientProfile,Channel,Affiliate)

  • drewbty Profile Picture
    78 on at

    Hi Grant


    Expected final output is a html table, final step in the flow is create html table

     

    I can't post the full Json as I'd have to just change all values to xxxx for integrity reasons, would take too long ( I thought it was CSV as that's the file output I selected in the flow step) 

     

    Assume there is a r\ and n\ in all the right places. Apologies but that was just a typo when I was manually blacking out the field data

     

    The row does contain 6 - that's because the final field has no data entry for it. Only the final column field (AffiliateID) can ever be blank

     

    Yes the columns will be the same every time

  • grantjenkins Profile Picture
    11,063 Moderator on at

    Here's a flow that will hopefully get what you're after. This assumes the only field that could be blank (as you mentioned) is the last field Affiliate.

     

    The full flow is below. I'll go into each of the actions.

    grantjenkins_0-1668603203735.png

     

    Compose JSON contains your sample JSON data (including just 6 items in the second record).

    grantjenkins_1-1668603263416.png

     

    Compose Array uses the following expression. It splits the body by \r\n and skips the first row since that contains our headers and we only want the data.

    skip(split(outputs('Compose_JSON')?['body'], decodeUriComponent('%0D%0A')), 1)

    grantjenkins_2-1668603356732.png

     

    Filter array just removes the last item (empty items). The expression is just:

    item()

    grantjenkins_3-1668603411827.png

     

    Apply to each iterates over each of the items from Filter array.

    grantjenkins_4-1668603443594.png

     

    Compose Split uses the following expression to split each of the items by comma. It will give us an array containing each of the items in the current row.

    split(items('Apply_to_each'), ',')

    grantjenkins_5-1668603516263.png

     

    Compose Object builds up an object for each row. The expressions are as follows:

    outputs('Compose_Split')[0]
    outputs('Compose_Split')[1]
    outputs('Compose_Split')[2]
    outputs('Compose_Split')[3]
    outputs('Compose_Split')[4]
    outputs('Compose_Split')[5]
    
    //And the last field that could potentially be emtpy
    
    if(equals(length(outputs('Compose_Split')), 6), '', outputs('Compose_Split')[6])

     

    Looking at the raw code using Peek code we see:

    {
     "inputs": {
     "Client ID": "@{outputs('Compose_Split')[0]}",
     "Username": "@{outputs('Compose_Split')[1]}",
     "First Name": "@{outputs('Compose_Split')[2]}",
     "Surname": "@{outputs('Compose_Split')[3]}",
     "Client Profile": "@{outputs('Compose_Split')[4]}",
     "Channel": "@{outputs('Compose_Split')[5]}",
     "Affiliate": "@{if(equals(length(outputs('Compose_Split')), 6), '', outputs('Compose_Split')[6])}"
     }
    }

    grantjenkins_6-1668603784278.png

     

    And finally, after the Apply to each, we have our Create HTML table which takes in the output from Compose Object.

    outputs('Compose_Object')

    grantjenkins_7-1668603863045.png

     

    After running the flow, we would have the following HTML table.

    grantjenkins_8-1668603909515.png

     

  • drewbty Profile Picture
    78 on at


    edit

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard