I have 2 Excel files and need to Vlookup one column from second Excel file into the first.
For this I created 2 Data tables from those two Excel files. I used For Each activity with Lookup Data Table activity to Lookup needed column from second Datatable. The logic is that I used Build Data Table activity for storing a column that should be result of Lookup Data Table activity. After I used Add Data Row activity to add resulted column of Lookup Data activity to just created new Data table. In the properties of Add Data Row activity I wrote: ArrayRow: {MyVariable.ToString}, where MyVariable is Variable where result of Lookup Activity stored and in the Data Table filed I indicated newly created Data Table. The problem is that the process of Lookup activity works very slow and sometimes getting Error: “Runtime execution error Source: Add Data row Message: Object reference not set to an instance of an object”. How can I fix it?
May be there are other ways I can vlookup data from two excel files?
Thank you for your video. I did exactly the same as you explained in your video, but got stuck at the part where you assign ID variable. What should be the Value of ID variable, if I have two Excel files as shown in the pictures:
I need to Vlookup rows from File2 to File1 into the Delivery_code_file_2 column (highlighted as yellow)
Also, I added two Lookup Data Table activities as you show in your video, but do not know which column name should I write in ColumnName filed in the Properties panel for both Lookup Data Table activities.
Could you please clarify?
By the way, Read range activity in my case worked only inside Excel application scope activity.
Hey @Apple1
Can you send the photo of you second Excel?
Whatever row you’re looking for in table two, once you get the index use that index to get the value of the column you want to write from file 2 to file 1(syntax is there in video) after that use that value in assign statement in for each row again syntax is there in video and all the syntax are shown very clearly in the video check again it will solve yoir problem.
and for the read range it only worked in Excel application scope because you’re usinf Excel Activities for the you require the scope in Workbook Activities you don’t.
I did it in the beginning, but it does not work
RowIndexTable1 - in your video instead of Table1 you use DataTable1, is not it? So it is RowIndexDataTable1, as I understood
for each row in DT1
assign the delivery_code_file_1 value to variable
look up data table for delivery_code_file_1 value in DT1 get the row index column
name here = delivery_code_file_1
row index variable name Ri1
look up data table for for delivery_code_file_1 value in DT2 get the row index column
name here = delivery_code_file_2
row index variable name Ri2
now you have two row index
assign
DT1.Rows(Ri1)("Delivery_code_file_2") = DT2.Rows(Ri2)("Delivery_code_file_2")
write range DT1 into the respective excel file
I hope this will solve your problem. Please do mark it as solution. @Apple1