Excel Lookup Range

Hi, I have an excel file. Der are nearly 100 columns in it and the indexes of columns are dynamic. I am using lookup range to get the column header index but it ie fetching the wrong value.

for suppose, AB1 contains “Multiskilled” and AD1 contains “Skill”, in the Lookup range i m given the string “Skill” to search, the output is AB1 as it partially contains the word skill. Is der any way to extract the exact index of the word we have searched.

Thanks in Advance

Hi,

To get column index pls use below syntax:

DataTable .Columns.IndexOf(“ColumnName ”).ToString

Pls mark it as solution if it solves your issue.

Happy Automation :slight_smile:

Thanks

2 Likes

@Konda_Sai_Charan_Goud

If you see the lookup properties you have an exact match property…you can check that check box and it should look only for the exact match

Alternately you can use find/replce activity which will give you the cell number of the found value…there you have option to match entite content of the cell instead of a partial match

Please let us know if you have issues

Cheers

Hi , in the current excel activities i dont have find/replace activity. If i update now, it will disturb the other codes. So is der any way to solve this with tye existing packages

Hi, the solution you provided gives the column index of that particular column in a datatable, but i need the address from the excel file

@Konda_Sai_Charan_Goud

You can use as mentioned by @Kalpesh_Chaudhari

Little extension to it is to convert the column index to the excel column name…you can use as below

UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnIndexToColumnLetter(Dt.Columns.IndexOf("ColumnName") + 1)

This will give you excel column name…and row anyways you know can append it

Cheers

1 Like