Vlookup column from one excel file into another

Hey guys,

Can someone create process for Vlookup two excel files attached and send me .xaml file?
Files excel.7z (171.1 KB)
I have been struggling with this issue several days and still it is not working.
Column from second excel file should be Vlookuped to first like this:


Check as below for your reference
Tutorial : How to check a string is present in Excel Sheet || Part - 1

Hope this helps you

Hi @ksrinu070184,

I created similar process, but I need to write cell values from File2.xlsx into the new column of FIle1.xlsx taking only those rows that exists in both file. How can I do it? I saw a lot of tutorials in web but could not find it.

Hi @Apple1

Kindly follow this way

  1. use read range to read the File2.xlsx file and store in dt1

  2. use read range to read the File1.xlsx file and store in dt2

  3. use for each row for looping through each row of dt1, Here in for each row property panel there is field called index, it will store the index of row of datatable through which u are looping. in that create a variable which store the index of iterating row , lets say rowindex

  4. inside for each row use lookup datatable activitiy with following parameter in the property ,

    a) lookup datatable = dt2
    b) lookupvalue = row(0).ToString
    b) lookup column index = 0
    c) rowindex = index ( an int32 varible which stores the rowindex of that lookupvalue in the lookup datatable

then after lookup datatable use an if Condition, with condition as,
index = -1, if index equal -1 then it indicates that there is no value in the dt2 which we are searching , so in then section of if activitiy , do nothing

While if index is not equal to -1 then the lookup value is there in dt2, then in else condition we need to use write cell activitiy with path of File1.xlsx and cell as “B”+(rowindex+2).ToString ,

with cell value as row(0).ToString

Like this way try and let me know

Mark it as solution if u got it

Nived N :robot:

Happy Automation :slight_smile: :slight_smile:

Thank you very much for you responce!
I created process as you described and it writes result in Excel, but only first found item from File2.xlsx to File1.xlsx in the range of cells:

The screen of result in Excel file above shows that found matched item: B0047 written only to “B10” cell, however it should be written into the range of “B11:B20”. Also found matched item B0066 is written into the cell “B21” only, however it also should be written in the range of cells “B22:B34”, can you please help how to do it?

Hi @Apple1,
I think instead of index to write the cell value, u need to use index value of row through which it need to iterating,
Kindly check my above post i had updated it.

Hope it helps

Nived N
Happy Automation

I changed Write cell Activity range to “B”+(rowindex+2).ToString and it is showing an error: “rowindex” is not declared. It may be inaccessible due to its protection level.
Where can I declare rowindex?

Hi @Apple1

In the property panel there is output section where there is Index, in that index u need to define the rowindex variable

Nived N

I updated the process and it is giving wrong result after 15 minutes of process execution:

Can you please check where could be an error?

YES , can u share the excel file?

1 Like

I attached them in .7.z
Files excel.7z (171.1 KB)
Are you able to open it?

yes @Apple1, will check and let u know

1 Like

waiting for your reply

Hi @Apple1
is it u need finally?

1 Like

Yes exactly :+1:

Hi @Apple1
kindly find the attached workflow for reference:
Lookup_Case.zip (366.7 KB)

Mark it as solution if u got it
Nived N
Happy Automation

1 Like

It works!
Process takes 40 minutes for execution on my side. What time did it take on your side?
Are there ways to make it work faster?

I think u need to use linq query for this

@NIVED_NAMBIAR can you please create process with linq query as well?

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