Support duplicate column names and avoid System.Data.DuplicateNameException
Closed this issue · 3 comments
Is your feature request related to a problem? Please describe.
I have following table
A | B | C | A | B | C |
---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 |
and ExcelHelper.ToDataTable()
throws System.Data.DuplicateNameException
Describe the solution you'd like
Implicitly, or explicitly via an argument parameter, add for example GUID identifier to duplicated column name, for example the 2nd column A
would be A_a48f0a43bae1469ab61ae60c15285325
in DataTable or similar solution.
Describe alternatives you've considered
An alternative is to probably change the excel header in memory and then load the DataTable, which is unnecessarily complicated.
Additional context
If you are interested, I am happy to send pull request, but not sure if to add this behavior as the default (but it probably makes more sense).
Hey @Ninjanaut , sorry for the delay, I'd created a pull request #126 , could you please help to have a look and leave your suggestions and concerns
A new preview version had been released https://www.nuget.org/packages/WeihanLi.Npoi/1.21.0-preview-20210913-151411
A new package version had been released https://www.nuget.org/packages/WeihanLi.Npoi/1.21.0