Hi,

I am trying to open a large excel file (.xlsx) to ad some rows of data from another excel file. However, due to the size of the destination file i am getting the memory error. I tried the below, however when i create the worksheet object it is creating a readonly worksheet and i am unable to add data.
wb=load_workbook('Test.xlsx',{'constant_memory': True})

Can someone tell me how to open the large excel file using openpyxl load_workbook method in write only mode?

Regards,
Dinil Karun E

Recommended Answers

All 5 Replies

I don't think it is possible. Using pydoc openpyxl.load_workbook shows a read_only option but no write_only option. It seems to exist only for new workbooks. I think using large excel files is questionable. Why not write a csv file with
python, then perhaps convert it to xlsx through other tools ?

Just because I'm trying some python stuff I looked at priors on this issue. Not once did they fix your issue except by changing to another Excel reader/writer or change to other than Excel for the data source. Other times the responders chided the OP about using Excel like this. So I take it you did your own research and found same. Your choice on the next move.

can you help with how it can be done using other excel writer? I am unable to find out a way. I am stuck with not being able to open the large excel file (.xlsx)

@dinikarun, Sorry no. I only did a little research and your complaint is not new. But the answers in the prior discussions was to try other readers. This sounded to me that the OP has to do that testing and work.

FWIIW, perhaps this can shed a light.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.