Kris Kiel
Kris Kiel

Reputation: 17

OpenPyXL and Large xlsx files

Does anyone know how to use openpyxl with very large excel files (at least 16 MB)? I am hoping to automate a daily excel file I pull daily for my job. I am having a lot of issues because this file is so large. So far I have set the file to read_only=True just to open it, but I cannot write into it to change the values. Is anyone an expert on OpenPyXL and can help me out?

Upvotes: 0

Views: 909

Answers (1)

xgsktx
xgsktx

Reputation: 198

You won't be able to modify an Excel file if you set the parameter read_only to True. If you cannot directly modify your existing Excel file because of excesive memory consumption, a possible approach could be opening such file as you are already doing with read_only=True, and create a new Excel file using write_only=True. Then, copy the existing worksheets from the first Excel to the new one, modify the values you want in the second and try to save the changes.

Other uses have already discussed a similar problem here.

Upvotes: 1

Related Questions