Problems with data table headers: A column named ... already belongs to this DataTable

Hello everyone,

I’m working on an automation to, basically extract from an excel file with several sheets information regarding hotel allotments and then paste it to a different excel file with a specific formation. I basically achieved my goal for the first sheet but I’m having problems doing the same for the following sheets, the problem being the following error:

ExcelReadRange dtSheetOutput: A column named ‘DATE’ already belongs to this DataTable.

I realize it’s something to do with the headers of the data table (dtSheetOutput) being repeated between sheets. I’ve searched ways on how to delete headers but from what I gathered, it’s not possible to have a data table without headers. I fear I’ll have to restructure the entire process.

I figure It’ll be hard to help me with just this incoherent information so I’ll share my entire project with you.

Just know that when you execute the main class, you should get an output named adagioFinal.xlsx and the exception “ExcelReadRange dtSheetOutput: A column named ‘DATE’ already belongs to this DataTable.” when going to the second sheet of the hotel excel (testAdagio.xlsx).

Thank you!

ADAGIO_Transformação de Dados.zip (979.4 KB)

give a try on untick add headers and let use autogenerated column names

  • readin in excel with read range - untick AddHeaders
  • rename your columnnames in datatable
  • remove first row (Header names from Excel)

Also have a look here

1 Like

Peter, you absolute legend.

I had to make a few more modifications to the project, but I think that worked.

Thank you!

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