Skip to content

Reading timedelta

nmartensen requested to merge topic/3.0/delta_in into branch/3.0

Since dates, times, and elapsed time are all usually stored as simple numbers in XLSX, openpyxl uses a heuristic to recognize the values as date/time representation and returns datetime.datetime or datetime.time objects for them. The heuristic is based on inspecting the number format style string (to see whether the format is any date format) and the stored value itself (to distinguish times from datetimes).

This MR refines the heuristic by adding support for recognizing and returning time interval durations as datetime.timedelta.

The helper functions in the documentation section on datetime handling are no longer necessary after this and can be dropped, which is done in the second commit.

Merge request reports