Maybe could you try using Join Datatables activity with the State and Price Group Desc columns as the columns to Match. Keep the Join Type as Left Join with First Input datatable being the 1st Datatables shwon.
As this should be a simpler configuration we are suggesting this.
(From row1 in dt1.AsEnumerable
Join row2 in dt2.AsEnumerable On row1("State") Equals row2("Price Group Desc")
Select dt2.Clone.Rows.Add({row1("State"),row2("Mat. Price Grp")})).CopyToDataTable
(From row1 in dt1.AsEnumerable
Join row2 in dt2.AsEnumerable On row1("State") Equals row2("Price Group Desc")
Select dt2.Clone.Rows.Add({row1("State"),row2("Mat. Price Grp")})).CopyToDataTable
It will select column from dt1 and its respective Price Grp from sheet2 into a new datatable. Using this you can rewrite it into sheet 1.
If you want only the Mat Price Grp you can do the below code,
(From row1 in dt1.AsEnumerable
Join row2 in dt2.AsEnumerable On row1("State") Equals row2("Price Group Desc")
Select row2("Mat. Price Grp")).ToArray
Let me explain, I have dt1, whhich has a total of 30-35 Columns.
This dt1 Contains one column “State” and Another column “State Code”(which is empty needs to be filled from dt2).(These 2 columns are included in that 30-35 columns).
Now,
I have another datatable dt2,
It has only 2 columns, “State” and “State Code”. Both has values. Now we have to match “State” columns in both the datatables and fill the respective codes that are present in dt2 in dt1’s “State Code” column.
(From row1 In dt1.AsEnumerable
Group Join row2 In dt2.AsEnumerable On row1("State") Equals row2("Price Group Desc") Into Group
From grp In Group
Select dt1.Clone.Rows.Add({row1("State"),If(grp Is Nothing,Nothing,grp("Mat. Price Grp"))})).CopyToDataTable
As per the above query,
It will Join the sheets based on the states
If the state is present it will provide the Mat. Price Grp value from sheet 2
If the state is not present, it will give empty string
This will be added to a output datatable that can be rewritten to the first excel sheet