Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openpyxl
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 264
    • Issues 264
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 6
    • Merge requests 6
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • openpyxl
  • openpyxl
  • Issues
  • #1867
Closed
Open
Issue created Aug 09, 2022 by Eneko Martin-Martinez@enekomartinmartinez

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.

Edited Aug 09, 2022 by Eneko Martin-Martinez
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking