Out of memory while reading excel file

Mahmood Naderan nt_mahmood at yahoo.com
Wed May 10 10:09:23 EDT 2017


Hello,

The following code which uses openpyxl and numpy, fails to read large Excel (xlsx) files. The file si 20Mb which contains 100K rows and 50 columns.



W = load_workbook(fname, read_only = True)

p = W.worksheets[0]

a=[]

m = p.max_row

n = p.max_column


np.array([[i.value for i in j] for j in p.rows])



How can I fix that? I have stuck at this problem. For medium sized files (16K rows and 50 columns) it is fine.

Regards,

Mahmood



More information about the Python-list mailing list