Eliminar columnas duplicadas

Buenos días, estoy trabajando con diferentes excels y en algunos casos vienen columnas repetidas. A la hora de leer el rango, me da un error por que las columas estan repetidas. Intente realizarlo con el remove duplicate pero no hace nada.
Espero que me puedan ayudar

@Guido_Bonanata,

Find the “AddHeaders” property of Read Range activity and set it to False. This will create data table with default Column names like Column1, Column2…

After reading the Data into Datatable change the required column names as you desired using this code in assign activity

yourDTVariable.Columns(0).ColumnName = “New Column Name”

Thanks,
Ashok :slight_smile:

For an Column Name renaming approach have a look here:

grafik

NewColNamesInfo=

(From t In dtData.Rows(0).ItemArray.Select(Function (x,i) Tuple.Create(i,x.toString))
Let t2 = If(String.IsNullOrEmpty(t.Item2.toString.Trim), Tuple.Create(t.item1, "COL"),t)
Group t2 By k=StrConv(t2.Item2.toString, VbStrConv.ProperCase).Trim.Replace(" ","") Into grp=Group
Let cg = grp.Select(Function (x,i) Tuple.Create(x.Item1, (k & "_" & i.toString).Replace("_0",""))).toList
Select cg).SelectMany(Function (x) x).OrderBy(Function (ot) ot.Item1).toList

Hi @Guido_Bonanata

Try reading the excel with excel activities.

→ Use the Excel process scope activity inside of it insert the Use excel file activity.
→ In Use excel file activity give the path of the excel file.
→ Inside Use excel file activity insert the read range activity and create a variable in the output.

If any duplicate columns are there it will read with out throwing any error.

Orelse

→ Use read range workbook activity, go to properties and uncheck the add headers option.
→ It will create some column names as Column0, Column1, Column2.
→ if you want to work with it you can use the column index instead of using column names.

Hope it helps!!