Data Table Columns, Index Number Vs Column Names Advice

Hi Guys,

Just some advice really, when referencing data table columns, is it better to reference the
index number or the actual name ?
Appreciate when adding columns this “can” alter the indexes, so thats a win for column names :grinning:



it is based on the project, but most likely we should choise the column names, so if the column change the position it wont affect the project, however in some of the projects that we have coluimn duplicate names we can use index, but we should keep in mind that it should be an standar file


1 Like


Preferrably zcolumn name is better because it is more redable any changes in structure will not effect the process amy new column added anywhere will not wffect the flow

On the contrary for column index it hs its own benefits when you want to perform some operation on eqch column then having index is better …also some times while scrapping data we might not retreive column names …so even then we can rely on index

Hope this helps


1 Like

You cannot have duplicate column names in a datatable.

you can assing same column name for your columns, it will thrown an exception from UiPath when you try to read it, here is an example

That error is happening when reading an Excel file and it’s trying to create a datatable. The error happens exactly because you cannot have duplicate column names in a datatable. This post is asking about how to work with datatables, which is a specific thing not relevant to Excel.

1 Like

yes exactly, to solve that you can read the excel without headers and the call the column with the index, thats why i was trying to explain

Hi Guys,

Thanks to all for the inputs, will take on board :ok_hand:
Me personally I prefer column names over index numbers, easier in the expression editor but
thats just me.

Thanks again.

1 Like

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