cancel
Showing results for 
Search instead for 
Did you mean: 

How to use lookup in SAP iRPA

0 Kudos

Hi,

I want to look up the column of one sheet with a column of another sheet and get the matching value.

e.g.: I want to match Region from sheet1 to Region in sheet2 and get the City value for that Region.

Please help me with this.

Thanks.

View Entire Topic
MartinaKolafova
Explorer
0 Kudos

You should use Get Values (Cells) to get the values from the sheets and Custom Script to get the matching object. I recommend avoiding a loop within a loop.

Example of custom script:

const sheet1 = [

{ ID: 1, Region: "Region A" },

{ ID: 2, Region: "Region B" },

{ ID: 3, Region: "Region C" },

];

const sheet2 = [

{ Region: "Region A", City: "City X" },

{ Region: "Region B", City: "City Y" },

{ Region: "Region C", City: "City Z" },

];

const joinedData = sheet1.map((obj1) => {

const matchingRegion = sheet2.find((obj2) => obj2.Region === obj1.Region);

return { ...obj1, ...matchingRegion };

});

Please vote for my Improvement Request concerning this topic - to have low code/no code activities for data processing - to avoid Custom Script: Improvement Request Details - Customer Influence (sap.com)