Convert list of dictionaries to datatable

I have a list of dictionaries with same keys in all dictionaries and different values. I want keys as column name and values as rows in a datatable. I am unable to sort out this case. Can anyone help on that?

Hi @bassu727

Check this post

Creating Dictionary(String, List(String))


Hello Ashwin, Thanks for your reply.

The case which you mentioned is to create a dictionary but I already have a list of dictionaries (System.Collections.Generic.List<System.Collections.Generic.Dictionary<System.String,System.String>>) with this variable type and all the dictionaries have the same keys and I want those keys as columns and their values in rows in a excel sheet tor datatable

Hi @bassu727

It should be quite straight forward (apart from the fact of using a dictionary of dictionaries in the first place :sweat_smile:).

Simple follow these steps:

  1. Build Data Table activity with the desired output
  2. Iterate over values in the dictionaries using For Each activity with a proper type set
  3. Use Add Data Row activity to add the information to your data table.

All steps are easily explained by searching on the Forum :slight_smile:

Thank you @loginerror