Ienumerable to datatable converstion

Hi guys how to write a column that is read to a new excel file. I’m finding difficulty in converting the read column variable to data table variable.

any examples would really help.

Have you considered using Read Range instead of Read Column? Then, you would have a data table.

2 Likes

Using read range and providing the right column range right, but is there any code to convert IEnumerable to data table variable in uipath so that we can easily write it using write range?

Thank you!

DataTable.Rows and DataTable.Columns implement IEnumerable.DataTable.Rows Property (System.Data) | Microsoft Docs

Thank you for the link but I’m a rookie in coding so can you give an example: like if column1 is my output variable from read column which is Innumerable object how to write this column of object to a new excel sheet using write range?

Thank you.

The reason why you aren’t getting an easy answer is because an ienumerable can be many things. To give 2 examples, if it’s an ienumerable(of datarow) then it’s as simple as appending .CopyToDataTable() at the end. If it’s an ienumerable(of anonymous type) that’s a whole different animal.

If you’re simply wondering how to convert a column to datatable, then the read range activity is going to be the fastest and best way to accomplish your task.

Thank you buddy…