-1
我想从我的excel sheet.Please删除前20行建议如下,但没有提到working.Installed所有openpyxl的solution.Tried许多方法来删除Excel中的行,xlrd所以请帮助如何使用python
workbook = xlrd.open_workbook('myfile.xlsx')
worksheet = workbook.sheet_by_index(0)
def delete_row(self, row, shift=directionUp):
"""
Delete the entire 'row'.
"""
self.get_range('a%s' % row).EntireRow.Delete(Shift=shift)
# worksheet.getCells().deleteRows(2,10,True)
#
# # Saving the modified Excel file in default (that is Excel 2003) format
# workbook.save(self.dataDir + "Delete Multiple Row s.xls")
1.Header是21行和运行此我失去头之后,而不是它的标题显示我\t无名:0 \t无名:1 \t无名:\t无名:3 \t无名:4 \t无名:5 \t未命名:6。第二个问题是 其增加了另一列与编号1,2,3 ....等,所以我不知道为什么发生这种情况。 – Gouri
更改了代码以将其包含在read_excel()fn中。 – Back2Basics