How add the duplicate column name in the data table

Hi Team,

I have a scenario called I need to add the same column name to the data table.
example:
Name, ID is present in the data table “DT1” in that I need to add Name column.

Can anyone help me how to add the data table?

1 Like

Hi,

Column name of datatable must be unique. So we cannot add column which name already exists in the datatable.
Can you share what you want to achieve at the end?
As workaround, we can set column names at the 1st row then write it without header option, for example.

Regards,

1 Like

@copy_writes

The column name must be unique
Read the excel to datatable
Add Datacolumn activity give unique name
Use For Each row in datatable
CurrentRow(“Name”)=Name
Write range

1 Like

@copy_writes

We cannot write the same column name more than once…instead we can append a number like counter to the name and use that so that it is unique and you can use it as needed

Cheers

1 Like

I am not getting your point can you please explain how to add data same column name?

1 Like

@copy_writes

You Can’t give two columns with same name, So you have to change the new column name.

If you attempt to add a column with a name that already exists in the data table, UiPath will raise an error, and the operation will fail.

To handle this situation

Rename one of the existing columns to make them unique

Add a new column with a different name

1 Like

@copy_writes

If you still want to add same name only…then instead of adding as name add the value in the first row and use the first row as you identifier to identify the columns

Cheers

1 Like

Hi @copy_writes

Columns in the Datatable has to be unique. We have to give another name to add a new column. If we want to add new column to the datatable. Use the Add Data Column activity which helps to add a column to the existing datatable.

Hope it helps!!

1 Like

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