Transforming DataTables, turning columns into rows

datatable

#1

Hello, I have a DataTable transformation issue that I need some help with

I have a DataTable I am reading from data1.xlsx (7.8 KB)
which looks like:

And I would like to transform this DataTable so that Columns A and C will form Row 1 of the new dataTable, and Columns B and D will form Row 2 of the new DataTable like in the following picture:

The number of columns in the original DataTable will always be 4, while the number of rows will vary.

I’ve tried some things like the Build Data Table activity and Add Data Column, but failed perhaps due to lack of experience with those activities. So for now I am stuck at looping through each row of the original DataTable where I can get specific dt.Row().Item().ToString values, but how do I get those values into the new DataTable that I want?

Thanks in advance for your help!


#2

@crobinson, This helps you,

Reading Data With Vertical Header From Excel to DataTable

Regards,
Dominic :slight_smile: