Read Range Error in STUDIO

When I’m using Single Excel Workbook with two sheets. I want to compare the data b/w Sheet1 & Sheet2. If data is matched change the Sheet2 row background color.

I’m using For Each Row for both sheets(Sheet1 & Sheet2) at the time facing this issue

Read Range: A column named ‘Sec’ already belongs to this DataTable.

help me to resolve this issue

Can you check if the sheet has two columns with the column name Sec in a single sheet?

Yes. Two-column names with Sec

Yeah, usually if the column name is repeated, then the activity will throw the above error. If you are able to rename one of the column, you will be able to get the data into a datatable

Thank you…!

Welcome to uipath community
This happens when two datatable being used have a same column name
For that to be avoided disable ADD HEADERS option in the read range activity and instead of column header with the expression inside for each row loop like row(“yourcolumnname”).ToString instead we can mention like column index like this
row(columnindex).ToString where column index starts with zero for first column
And then we will be able to compare them

Hope this would help you
Kindly try this and let know for any queries or clarification
Cheers @Rajesh_Nalleboina


I’m facing an issue on Set Range Color. I’m Comparing the 2 sheets in excel workbook data. If data matched in both sheets I want to change the sheet2 data color to red. If the data matched the row color would be changed. If the data matched another for another row the color doesn’t change for the second row. Testing purpose I’m displaying the log message. please find the below image & ExcelWorkbook data.

excel_Data.xlsx (9.8 KB)

The issue I am facing earlier was related to Dependency files which were missing on Terminal server’s local drive. I copied all dependency files like Excel activities, RestSharp, csvhelper and Newtonsoft.Json from Local machine to Terminal Server under .nuget folder.
Moreover we have to sure we have the same path for %AppData% in both Local and Terminal server

Tech Consultant

Hi everyone, once i’d faced with the same issue at a read range activiy within a while loop, i also recognized that the issue was being supressed when i deleted what whole rows inside the input excel file. After that discernment, i only added headers my read range activity and the problem was gone. If u have this kinda read range activities within a loop, you may need to add headers as i did. Because excel files (actually the DataTables which u used to store them) need unique column names. if u dont give them one, they start to complain about.

best regards,