简体   繁体   中英

Openpyxl load_workbook and save take too long

The following lines take 45 seconds the first, and over a minute and a half the second. Something.xls is 4 MB big and the changes are minor. Is there something wrong?

something = openpyxl.load_workbook('Something.xlsx')
something.save('Something.xlsx')

Some details: I'm using Python 2.7.3 on Windwos 7, the workbook has 2 sheets the first of which has 67610 rows, I'm not accesing any network to do this job.

So I created a 67k row excel sheet with only 4 columns and random decimal data - and the sheet was almost 5MB, so >1000x what you said in your question. Given that this is a decent amount of data I would suggest using the optimized reader, not the normal one. Here's a link to the tutorial:

https://openpyxl.readthedocs.org/en/latest/optimized.html

Hopefully this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM