-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