Python to delete a row in excel spreadsheet

前端 未结 6 697
走了就别回头了
走了就别回头了 2021-01-20 03:21

I have a really large excel file and i need to delete about 20,000 rows, contingent on meeting a simple condition and excel won\'t let me delete such a complex range when us

6条回答
  •  既然无缘
    2021-01-20 03:39

    Don't delete. Just copy what you need.

    1. read the original file
    2. open a new file
    3. iterate over rows of the original file (if the first column of the row does not contain the value X, add this row to the new file)
    4. close both files
    5. rename the new file into the original file

提交回复
热议问题