Context: I was working on a UiPath automation where I needed to use the ‘Select’ method on a DataTable. This DataTable was created by reading an Excel sheet where I intended to filter data based on a specific column.
Issue: I encountered an unexpected error stating “Assign: Cannot find column [ColumnName].” Despite confirming the presence of the specified column in Excel, the error persisted.
Discovery: Upon further investigation, I realized that the root cause was related to the placement of the column headers in the Excel file. In my case, the headers were not in the first row. Even though I specified in the ‘Read Range’ activity that the sheet contains headers, UiPath automatically inserted a new row at the beginning with default column names like ‘Column1’, ‘Column2’, etc., before the actual header row.
Solution: The key to resolving this issue was to delete the extra row that UiPath had added. After adjusting the range in the ‘Read Range’ activity to start from the actual headers and removing the additional row, the ‘Select’ method worked as expected.