Z-Statistic
Z-Statistic

Reputation: 11

Loading .xlsx file throws 'date not well formatted'

My code is very simple:

var thisWorkBook = WorkBook.LoadExcel(path);

I have a manual workaround where I go into the file via Excel/Google Sheets and remove a column. That works. For some reason.

The .xlsx file is a work schedule that has the following organization:

File name: Schedule-2021-10-12

sheet1[hourly - position1]:

Employee ID Employee Position Date (e.g. 10/12/2021) Total Hours Unpaid Breaks Hourly Rate Total

After the each entry belonging to position1 is listed, column A tallies up cost

sheet2[Schedule - position1]

Date Employee Employee ID Position Schedule Site Start End Unpaid Break Total Hours Labor Cost Status Notes

Now, the Date in this sheet is not formatted the same way as in sheet1 e.g. 10/12/2021 12:00:00 PM. Removing this column stops the code from throwing the exception. I'd leave it at that except there are 14 sheet in total, 7 of which have that date format, but I only have to remove the column from the first of those sheets to fix the exception. Renaming the file doesn't fix the exception. I didn't expect it to, but black magic and all that.

I found some documentation in IronXL that there's a method I can load 'options' into. However, I'm fairly new the programming and don't know what kind of options I can add or if this could even solve my problem.

Upvotes: 1

Views: 240

Answers (1)

darren
darren

Reputation: 494

This was a bug, resolved in IronXL.Excel version 2021.11.0, released on 2021-10-29

Simply updating to the latest version will remove this issue.

PM > Install-Package IronXL.Excel

Note: I work for Iron Software

Upvotes: 0

Related Questions