theorchard / openpyxl

Other
54 stars 21 forks source link

sheet.append() and sheet.cell() get progressively slow as more rows are added. #37

Closed hammersharkfish closed 1 year ago

hammersharkfish commented 1 year ago
    for col_num, value in enumerate(values_to_insert, start=1):
        sheet.cell(row=client.row_number, column=col_num, value=value)
    workbook.save('analysis.xlsx')

One can understand why sheet.append() is slow [it must be iterating till the last row everytime] but sheet.cell(row=client.row_number, column=col_num, value=value) shouldn't behave the same way because I am providing the row number manually. There should be an insertion to that row directly skipping the iterations altogether .

hammersharkfish commented 1 year ago

It wasn't sheet.append() or sheet.cell() but workbook.save('analysis.xlsx') which progressively took more time as workbooks size increased .