How to convert column to row using LinQ

:loud_sound: How to convert :airplane: column to row using LinQ :chains:

:rocket::rocket::rocket::rocket::rocket::rocket::rocket::rocket:
To convert a column to a row in UiPath using LINQ, you can use the Select method along with ToArray or ToList to convert the result into an array or list. Here’s an example assuming you have a DataTable and you want to convert a specific column into a row.

InputDt:

[Input data
"Bala
4,satha st,
gobi
erode .
tamilnadu
robotic process automation-UiPath"
"Bala
15,vedha st,
sathy
Namakkal .
tamilnadu
robotic process automation-UiPath"
]

OutputDt:

[A,B,C,D,E,F
Bala,"4,satha st,",gobi,erode .,tamilnadu,robotic process automation-UiPath
Bala,"15,vedha st,",sathy,Namakkal .,tamilnadu,robotic process automation-UiPath
]

Code:

(From rows In dt_input.AsEnumerable
Let a = Split(rows("Input data").ToString.Trim,vbLf).ToArray
Select dt_output.Clone.Rows.Add(a)).CopyToDataTable

Thanks,

1 Like