web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Transpose Column to Rows
Power Automate
Unanswered

Transpose Column to Rows

(0) ShareShare
ReportReport
Posted on by 221

The following flow is working and returning an email.  I would like to transpose the column headers to run vertically instead of horizontally.  For example:

 

Station:

House Number:

Street:

City:

County: 

...

 

Would anyone know what is necessary to achieve this result?

 

Shaguar357_0-1674509214100.png

Shaguar357_2-1674509248696.png

 

Categories:
I have the same question (0)
  • grantjenkins Profile Picture
    11,063 Moderator on at
    Re: Transpose Column to Rows

    Are you expecting more than one row of data here, or would there be multiple? I'm assuming single row of data, but just wanted to check first. If you could provide a sample of the output you wanted including some actual data, that would help.

  • Shaguar357 Profile Picture
    221 on at
    Re: Transpose Column to Rows

    Hi @grantjenkins ,

     

    You are correct.  I'm only pulling one row of data at a time. 

     

    I'm still fairly new to building flows.  Is this the output you are looking for:

     

    <style>
    table {
    border: 1px solid #1C6EA4;
    background-color: #EEEEEE;
    width: 100%;
    text-align: left;
    border-collapse: collapse;
    }
    table td, table th {
    border: 1px solid #AAAAAA;
    padding: 3px 2px;
    }
    table tbody td {
    font-size: 13px;
    }
    table thead {
    background: #1C6EA4;
    border-bottom: 2px solid #444444;
    }
    table thead th {
    font-size: 15px;
    font-weight: bold;
    color: #FFFFFF;
    border-left: 2px solid #D0E4F5;
    }
    table thead th:first-child {
    border-left: none;
    }
    </style>

  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at
    Re: Transpose Column to Rows

    I've created an example that will hopefully get what you're looking for.

     

    The list I'm using for this example is below.

    grantjenkins_0-1674634079612.png

     

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

    grantjenkins_1-1674634126172.png

     

    When an item is created will trigger when I create a new item.

    grantjenkins_2-1674634158301.png

     

    Compose builds up the object structure that we will use to create our HTML table. It effectively maps out an array of objects where we specify the Name of the property and the Value of the property using our dynamic values. I've also formatted the Created date, so it displays a bit nicer.

    [
     {
     "Name": "Title",
     "Value": @{triggerOutputs()?['body/Title']}
     },
     {
     "Name": "Amount",
     "Value": @{triggerOutputs()?['body/Amount']}
     },
     {
     "Name": "Created",
     "Value": @{formatDateTime(triggerOutputs()?['body/Created'], 'dddd, dd MMM yyyy')}
     },
     {
     "Name": "Status",
     "Value": @{triggerOutputs()?['body/Status/Value']}
     }
    ]

    grantjenkins_3-1674634593546.png

     

    If we ran the flow now, the output from our Compose would look similar to below.

    [
     {
     "Name": "Title",
     "Value": "Harold"
     },
     {
     "Name": "Amount",
     "Value": 88
     },
     {
     "Name": "Created",
     "Value": "Wednesday, 25 Jan 2023"
     },
     {
     "Name": "Status",
     "Value": "Pending"
     }
    ]

     

    Create HTML table uses the output from the Compose.

    grantjenkins_4-1674634629555.png

     

    Compose Style has our CSS to style the table. I've used some sample CSS, but you can just add your own here. In my CSS I've actually hidden the header of the table.

    <style>
     table {
     border-collapse: collapse;
     }
     table td {
     border: 1px solid #ddd;
     padding: 6px 20px;
     text-align: left;
     }
     table th {
     display: none;
     }
     table td:first-child {
     font-weight: bold;
     }
    </style>

    grantjenkins_5-1674634709333.png

     

    Send an email uses the output from the Create HTML table and Compose Style, similar to what you've already done.

    grantjenkins_6-1674634751871.png

     

    The output we get in the email is shown below.

    grantjenkins_7-1674634899770.png


    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, please consider giving it a Thumbs Up.

  • Shaguar357 Profile Picture
    221 on at
    Re: Transpose Column to Rows

    Hi @grantjenkins ,

     

    Thank you for taking the time to explain and lay this out for me!  I greatly appreciate it!  

     

     

     

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

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard