Duplicates in excel


#1

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


#2

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


A column named already belongs to this datatable
#3

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: