Lookup of data table - column names?

Hi all,

Should be simple, but can’t get it to work! I have loaded an Excel sheet into a data table in Studio with Use Excel File and Read Range. I want to search for a given value in column A and retrieve the value of the cell in the matching Column B, using Lookup Data Table. In the Read Range method, I ticked the Has Header box. Unfortunately the Lookup fails with:

05/12/2022 16:52:29 RemoteException wrapping System.ArgumentException: In the ‘Lookup Column category’ the value for argument ‘Column Name’ is not set or is invalid.

But I can’t for the life of me figure out what the Column Name should be. I have tried both the name in the header, using quotes (“Staff number”), and just “A” as it’s column A, but same error. Any idea?

Thanks!

Vincent

Set a breakpoint on the activity after the Read Range. Run in Debug mode. When it stops, look in the debug panels and you can see the datatable variable and expand it to see all the column names and other properties.

Hello @vincent.schoenfeld ,

Will it be possible to share the screenshot the 2 excels and the workflow which you have created?

Also did you tried this lookup manually in the excel?

Hello @vincent.schoenfeld

You will also have to set the property Column Name(column name of B column) under Target Column as well in the Lookup Datatable activity.

Thanks Paul! Once I figured out I had to add the data table variable to the watch list (I am very new to UIPath), I could see the column names. For some reason, they are Column1, Column2, etc. Which means I no longer get an exception, but a bit surprised that the actual column names were not imported by Read Range since I had ticked Has Headers?

I did set the column name in that Property, but turns out the constructed data table is using Column1, Column2, etc instead of the actual column names. Not sure why!

You don’t need to add it to the watch list. You can see everything in the Locals panel.

Can you show us your Excel file?

@vincent.schoenfeld Can you try providing the column index instead of column name

Capture

Note: The column index always starts with 0

Sorry Paul, been away from the office, but appreciate your answers and it’s now working as it should :+1:t2:

1 Like

Thanks Ushu, managed to get it working in the end :+1:t2:

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