How To Transpose DataTable – In UiPath

luke-chesser-JKUTrJ4vK00-unsplash.jpg

Few times while working with DataTables, we might want to convert rows to column and vice versa.

let’s see how to do that…!!!

Example

Implementation using UiPath :

Let us implement a workflow to convert rows to columns in DataTable.

(If you find the logic a little difficult to understand, no worries please leave a comment and we will get back to you soon)

Sample File:
UiPath DataTable Transpose 0.PNG

Step 1:
Drag “Excel application scope” and “Read Range” activities into the designer panel to read the input excel

UiPath DataTable Transpose 1.PNG

Step 2:
Drag “While“, “Add Data Column” and “Assign” activities into the designer panel to create dummy columns
(Because here we are transposing the headers too)

UiPath DataTable Transpose 2.PNG

Step 3:
Drag “For Each Row“, “While“, “Add Data Row” and “Assign” activities into the designer panel and write the logic to convert rows to columns.

UiPath DataTable Transpose 3.PNG

Step 4:
Finally, execute the workflow to see the results 🙂

UiPath DataTable Transpose 4

Click here to download the Source Code…

Hope it has helped you… 

 

Advertisements
Sharath Raju

Author: Sharath Raju

Co-Founder @www.ExcelCult.com

4 thoughts

  1. Hi Sharath Raju,

    Can you please explain the transpose project in detail, i.e. what is the neccessity of each activity inside the for each loop. it would be helpful for us to catch the stuff easily.

    Best Regards,
    Naveen Kumar S

Leave a Reply