Duplicates in excel

Hello,

I am practicing having UiPath read a large excel file before I break up the data. Within the excel file there are duplicate names and company names. When I run the bot I get an exception where it says

Source: Read Range

Message: A column named ‘Red Company’ already belongs to this Datatable.

ExceptionType: Dublicate NamesException

Does anyone know how to fix this?

Thanks

Hi,

Do you have two headers with the same name ‘Red Company’? In a DataTable it is not possible to have columns with the same name.

Regards,
Jules

1 Like

Hi @Cormac,

Use Read Range activity to get get as Data Table (Uncheck the Add Header Properties)
create array Variable arrHeader

arrHeader=DatatableName.select()(0).ItemArray

check if condition arrHeader.Length = arrHeader.Distinct().Count()
True->No Duplicate in the Column Header.
False->Duplicate in the Column Header.

Regards,
Arivu :slight_smile:

1 Like