Cells with special number format interpreted as date
If a cell has a custom number format (in my case Y000000
), the stylesheet parsing (called in excel.py
, line 279) recognises and registers this as a date format. Later-on, in worksheet._reader.py
, line 200, the numbers are converted to dates as a consequence of this:
if style_id in self.date_formats:
data_type = 'd'
I have a hard time getting back the correct number, even using the to_Excel
function, that gives me e.g. an offset at 60.
I realise the challenge is really Excel's sloppy handling of dates and date-times. But could there be a flag given to load_workbook
that preserves numbers as numbers when datatype is n
?minimal_y_formatted_in_A1.xlsx
Attached an Excel file with only cell A1
containing data. The cell contains the number 60
, formatted as Y000000
, hence displaying Y000060
in Excel.