How to convert iEnumerable into datatable

Hi All

I have used get Queue item activity in UiPath and i got the output ienumerable values, how do i convert into datatable without loop?

Can anyone suggest me how do i do that?

With loop

  1. Build Data Table (Create an empty DataTable with the desired columns)
  2. For Each item in IEnumerable
    a. Add Data Row (Add each item to the DataTable)

With out loop you can try this way



Hi @divya.17290 ,

Could you maybe check with the below post :

He suggest the querry " JArray.FromObject(YourGetQueueItemsOut.Select(Function (x) x.SpecificContent).toArray).toObject(Of DataTable)" but i got error for JArray not declared

I got error

Can you try this

Assign Activity:
dtData =

JArray.FromObject(YourGetQueueItemsOut.Select(Function (x) x.SpecificContent).toArray).toObject(Of DataTable)


How do i declare JArray?

I got error

@divya.17290 ,

Modifying it a bit to add the namespace, could you check the below expression :

Newtonsoft.Json.Linq.JArray.FromObject(YourGetQueueItemsOut.Select(Function (x) x.SpecificContent).toArray).toObject(Of DataTable)

Could have also performed a Import from the Import Panels which should able us to use the Expression suggested earlier :

I can extract the queue items and write into the excel.Thanks!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.