We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

A columne named 'xy' already belongs to this DataTable

Hello, I am trying to import data from an excel sheet, however it contains two columns with the name ‘Date’ which cannot be changed. I tried to use ‘new Aspose.Cells.ExportTableOptions() { RenameStrategy = RenameStrategy.Digit }’ but I am still getting the same error. I would appreciate any help or idea on how to fix it. If RenameStrategy is the correct approach, an example on how to do it would be of great help, I am building this solution in C#. Thank you. Michal.


Could you please paste your sample code (runnable) to show the issue. Also, zip and attach your template Excel file from which you are exporting data to fill the DataTable.

Also, some workarounds to cope with your issue are as following (you may choose any of the workarounds).

  1. Please do not export column names (specify the relevant option in ExportTableOptions to false) when you export data from the worksheet. By default, the first row will be taken as column names, so you may start importing from second row.
  2. Please create your desired DataTable with your desired (new) column names (which will hold worksheet data), so you may export worksheet data to it. You may use/set DataTable attribute (to your created DataTable) under ExportTableOptions.

Hope, this helps a bit.

Thank you very much for you assistance, I was able to fix the issue using your tips.


Good to know that your issue is sorted out by following the suggestions/tips. Feel free to contact us any time if you need further help or have some other queries or issue, we will be happy to assist you soon.