Transforming DataTables, turning columns into rows

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!

@crobinson, This helps you,

Reading Data With Vertical Header From Excel to DataTable - #2 by Dominic

Regards,
Dominic :slight_smile:

1 Like