Transposing Excel Data Into a DataTable

@Jeavo
Please Copy all these files into a folder and run the Main xaml. You will get the Output. I tried to zip the folder and upload but it is showing some error.
It will dynamically transpose the Input Excel. You need to pass only Path of Input Excel Sheet.
I am using two queries to transpose here.

  LstdtSplitData= (From p In dtInput.Select().Take(Convert.ToInt32(dtInput.Rows.Count/dtTranspose.Columns.Count))
Select dtInput.Select().Skip(dtInput.Rows.IndexOf(p)*dtTranspose.Columns.Count).Take(4).CopyToDataTable).ToList

argdtTranspose = (From p In LstdtSplitData
Let x=String.Join(",",From q In p.Select
                                  Select Convert.ToString(q(1)))
Select dtTranspose.Clone.Rows.Add(x.Split({","},stringSplitOptions.None))).CopyToDataTable

You will get the output of Transposed DataTable.

Main.xaml (4.9 KB)
TransposeExcel.xaml (9.7 KB)
project.json (641 Bytes)
Transpose.xlsx (8.9 KB)

Please Copy all these files into a folder and run the Main xaml. You will get the Output. I tried to zip the folder and upload but it is showing some error.

Regards,
Mahesh

4 Likes