Extracting value from excel sheets based on ID

Hi

Input file

MR_Database.xlsx (13.1 KB)

In the input file i need to extract “Quantity” value for “Lemon” in sheet 1 based on ID i.e “5” in sheet 2

How can i write logic for it.

Thanks in advance
Likitha

@vinjam_likitha

Read sheet 1 then…use filter datatable and filter the datatable with the required id… and the name of fruit…

If you want to repeat this for each id…

Then read sheet2 and use a for each row in datatable and inside that use thw same filter to get each value

Hope this helps

Cheers

hi @vinjam_likitha

Dt.Select("[ID]=‘+Var+’ AND [Name]=‘lemon’)(0)(“Quantity”).tostrin

*Note
Var = Variable(ID=5)

Regards
Loveleet Saini

Hi ,

@loveleet_Saini What is the datatype for the output that we get for the above expression

Thanks

@vinjam_likitha

Datatype = string

Hi @loveleet_Saini

I have doubt in the above expression the quantity is in sheet 2

I have to read each row from excel ID is common and based on fruit i need to pick the Quantity.

in for each i have to write the expression?

Thanks
Likitha