Worksheet __getitem__ time performance its affected by the position of the range to subset
Hi,
I am currently working with a very large workbook file which has some worksheets of 76000 lines.
The data is split into 2170 smaller boxes with cell range names.
I read the woorkbook in data_only
and read_only
mode.
The process of getting the coordinates of each cell range name is fast. However when getting the values with __getitem__
the process becomes slower when I go to "deeper" rows, see the example below:
wb = openpyxl.load_workbook(..., read_only=True, data_only=True)
ws = wb[sheetName]
ws["$D$20:$I$54"] # this takes aprox 8ms in my computer
ws["$D$3820:$I$3854"] # this takes aprox 300ms
ws["$D$25800:$I$25834"] # this takes aprox 2s
ws["$D$75800:$I$75834"] # this takes aprox 6s
Therefore, I was wondering if some of the methods that are used for getting the elements are iterating from the first row of the file instead of going first to the first row of the range.
I am open to contributing if someone can help me get the information about the possible origin of this time increment.