Unable to iterate through columns

i want iterate through the rows while iterating through the columns. i’m trying to use 2 loops but i am not getting the desired output. i’m trying to store the values in a second DT as

i’m trying to store the values in a second DT as from 1st row, then same for the second row

Hello @diggikar.s I couldn’t able to understand your scenario can you please explain in detail what is input and what is the expected output

I think you are taking Transpose of DT. If I am right. Then please fallow these steps.

here is an easy way to transpose row values to columns.

Assuming you already have a datatable (lets call it dt_source) with one column of relevant values, which you want to transpose to columns.

  1. Initialize a new empty datatable (for transposed values, lets call it dt_target)
  2. Iterate through dt_source with a For Each Row activity
  3. Inside the For Each Row Body insert an Add Data Column activity
  4. Fill the properties with the target datatable (dt_target) and the ColumnName (that would be the row(“value”) to be transposed)
  5. That’s it, you’re done. Write Range (dt_target) to Excel to inspect your results.

Happy automating

(From c in DT.Colums.Cast(Of DataColumn)
Let a =DT.Asenumerable.Select(Function(r) r(c).Tostring).To array
Select DT2.Rows.add(a)).Copytodatatable