Can't Get Openpyxl To Delete Rows
I'm using Python and OpenPyXL to merge two Excel reports. When a report has a row of all zero values, that row should be deleted. The command to delete rows seems simple enough, bu
Solution 1:
Because you are deleting rows from the top of the worksheet you are adjusting row indices as you go. This means that as soon as you have deleted a single row, the indices for all the other rows you want to delete are wrong. To avoid this you should always delete rows from the bottom of the worksheet.
for r in reversed(del_rows):
ws.delete_rows(r)
Post a Comment for "Can't Get Openpyxl To Delete Rows"