How to read dictionary values

Hi Team,

Hope everyone is safe and good.


I need help on how to read value from dictionary
In this, I don’t have column name.“column 0” is my key and “column 1” is my value.Need to read A with Sharan, B with Mahesh etc.

1)assign activity with value as new Dictionary(of String, String)
2)Read range with giving details of sheet name, path and output as dt
then how to move further? I am not getting.

Can anyone will guide me please
This is the sample excel sheet


Hope the following helps you.



1 Like

@Sharanabasava_Kallur Follow the below Steps :

  1. Use For Each Row on DT.
    Inside For Each Row use Assign Activity in the below way :
    dictVar(row(“Column0”).ToString) = row(“Column1”).ToString
1 Like

use assign
left side your dict
right side:
YourDataTableVar.AsEnumerable.ToDictionary(Of String, String)(Function (r) r(YourKeyCol).toString, Function (r) r(YourValueCol).toString)

find demo here:
DataTable_2Col_ToDictionary.xaml (6.5 KB)


I am getting this error
Assign: Cannot create an L-value from the given expression with property ‘set_Item’ because the target object is null.

1 Like


Did you create an instance for dictVar as the following?



init the dict before with new Dictionary(Of String, String) e.g. default value on variable panel

I cannot use build data table,beacuse I want to read an excel and that value need to paste into different excel.

the demo code was intented to show on how the datatable can be brought to a dictionary. For sure it will work also with the datatable that you have received with the read range by readin the excel

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