How to Unpivot Excel Columns

Hello there,

I was wondering if there is an option to unpivot excel column or data table column in UiPath?

For example: Changing this coulms

image

Into this one. I have tried several methods but didn’t get the desired output.

Thanks

image

did you try create pivot table activity
provide the required details like source , destination , fields you want as rows
Regards

You can use power query to achieve this

@Nitya1

Yes I know I can achive this using power query. But I want to know if there is such option in UiPath studio.

Hi @LAKSHMI_NARAYANA_PEMMASAN ,

I haven’t created pivot table activity. I want to have the excel data to be read and stored as DataTable with several columns but those 3 colums in the above picture should be unpivoted as I have showed above.

I have created this using Excel Power Query but I want to do it in UiPath Studio.

Regards
Michaek

There is no such activity in UiPath Studio to
achieve this.

@gurmemi

There is no direct activity but you can try like this

  1. Read the data into datatable dt
  2. Use build datatable activity with one column and add three rows and the values should be fee , price and total and output datatable as outdt
  3. Use for each row in datatable activity on dt
  4. Use add data column and give a name as "value" + currentindex.tostring
  5. Use multiple assign assign with outdt.rows(0)("value" + currentindex.tostring) = currentrow("fee") and
    outdt.rows(1)("value" + currentindex.tostring) = currentrow("unitprice") and outdt.rows(2)("value" + currentindex.tostring) = currentrow("total")

Cheers

I suggest you to use python scope in UiPath to address unpivot.
I have tried some ways to solve it such as to use sql or .net in UiPath, but failed.
And in the python script, use pandas package which has melt function to unpivot dataframe. That will solve your problem.
More details, you can see the article in my blog: