Is there a more efficient way to generate values with openpyxl? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

Is there a more efficient way to generate values with openpyxl?

when I assign a value to a cell w/ a for loop, the value doesn't stick unless I save during every iteration. for one program I've got to save the file over 100,000 times before it's done. the program has been running over 3 days now and as it grows, the open, close, save routine is taking longer and longer. example: import openpyxl for i in range(1000000): wb = openpyxl.open_workbook('somedirctory\\somefolder\\somefile.xslx') ws = wb.active wc.cell(row=2i,column=1).value = I wb.save(

6th Sep 2017, 1:44 AM
Michael Langan
Michael Langan - avatar
1 Antwort
0
figured it out :) when I made the for loop return a cell item, then saved the file just after, it worked fine. I did run into another problem with memory overflow though.... the for loop crashed after about 800,000 returns :)
9th Sep 2017, 3:16 AM
Michael Langan
Michael Langan - avatar