Unable to Vlookup in Uipath

GCSR Rule Updating.xlsx (15.0 KB)

My Entire project base on SAP.
In the First sheet , the data will be updated manually,
In the second sheet , data downloaded from SAP from corresponding Sales order.
Then I have updated the Index no in sheet 2.
Based on sheet 1, BOT Will search data from sheet 2 and written in the Sheet 3 ( completed)
Then I will do Vlookup and enter the Index no in the sheet 3.

There will be multiple Sales order in Sheet1 during live project.

I hope you understand my project.

Attached the excel.

There will be multiple Sales order in Sheet1 during live project.

That is what I have mentioned before. If you want to have output value - CellValue - you need to specify RowIndex and Target Column/ColumnName.

I have done simple component for your issue. Please check the attachment with excel file. Try to run it on your end and let me know if that is what you have been trying to achieve.
Keep in mind that some values needs to be converted toString to make it working properly.
In our case the output value is Double so I have just used Assign to convert it to string and then write to the excel (Sheet3).
I have noticed that the index is the same row number which is RowIndex output from Lookup activity. If it is always like that you do not even need to read Index column but just write RowIndex to Sheet3.
Wouldn’t be easier to write Index column in Sheet1?

This is how the lookup should looks like:

Sequence:

Please run the attached solution and should you have any question just let me know:

lookup forum solution.zip (67.1 KB)

ps if that help please like it and mark as the solution :wink:

Regards,
Kamil

1 Like

Perfect !!!

1 Like

Hi Kamil,

Thanks. Let me try this one.
Can you please tell me what is "genericIndexfromExcel" under output cell value.

Did you declared variable in RowIndex = “intRowindex”

  1. " genericIndexfromExcel" is just the variable which is Generic type - I choose generic type as we do not know sometimes what type is the data in the excel file that you want to get. In our case it is double (number) so you can also put there a variable type double. The name is build using convention like this: ‘type+VariableName’.

  2. intRowIndex is the variable type Int32. It is empty because it is used by Lookup activity to store row index in which the searched values was found. It has to be created as a placeholder to be able to get cellvalue as output.

It works for sure :wink:

Thanks.

Let me try this one. will let you know.

Thanks Kamil.

I have tried getting below error in lookup activity.

image

Have you changed anything or did you used different excel for that?
If you changed anything, please send your solution here.

Nope.
I didnt change anything.


Both the Cell Value & Row index variables are Int type.

Cell_value cannot be Int as it is Double type after getting it from Excel.
that is why I choose Generic type, it allow us to store almost any type in the Generic.

image

this is completely wrong. You are trying to search column? You have converted the whole column to string instead of just the value from the row.
Please follow my solution and try to debug more. Use log messages and debugging as it looks like you are missing basic checks :wink:

Now getting below error
image
image

Ok, we are almost there. We made a small mistake I suppose. DataTable is indexing from 0 but Excel first row is 1. In that case we need to add 1 to RowInd first and then put it in Write Range :wink:
Please put one more Assign an To RowInd giv value: RowInd+1 .

1 Like

It is written like this.
image
Without Header.

One more thing why it is written two row.
I need only one.

Right to keep headers you neeed to add 2 to rowInd.
I have no idea why there are two rows, you need to show me the entire flow.
May be you have duplicates in the source table or so.
How you write columns A,B,c and D ?

The entire process is link with SAP.
I dont know if it will run in your system.

Let me add 2 in rowind and try.

In other Sales order, its comes with single line, but in this case its giving me 2 row.
Dont know why.

OF AUTOMATION Part 2.zip (8.8 KB)

Please check and let me know.

Are you sure there are no duplicates?
It is fine to send me the xaml so I can analyze your uipath flow.

So, there are many unnecessary activities like Read and Write range multiple times.
also Excel scope is duplicated unnecessary. I think you are getting two the same rows because either there are duplicates in Overriding table or because you have to many ForEachRow inside each other.
Try to split the flow and do the data preparing separately step by step (each sheet in separate sequence.

You do not need to write cell/range each time you add a row to datatble, prepare one datatable then write range to excel, then prepare another table separately and write it the excel. Also once you wrote the table to the excel you do not need read it right after writing as it is still in your variable.

image

image

PS.
there mentoring portal from uipath:
UiPath · Login · The Mentoring Platform

If you would like to, please register there and I can offer you a mentoring. We would be able to schedule a short meeting on which I could review your solution and give you more tips, suggestions and so on :wink:

Regards,
Kamil