python 3 delete row from xlsx

Solutions on MaxInterview for python 3 delete row from xlsx by the best coders in the world

showing results for - "python 3 delete row from xlsx"
Dylan
31 Jul 2020
1 def delete_row(self):
2
3\# Instantiating a Workbook object by excel file path
4
5workbook = self.Workbook(self.dataDir + 'Book1.xls')
6
7\# Accessing the first worksheet in the Excel file
8
9worksheet = workbook.getWorksheets().get(0)
10
11\# Deleting 3rd row from the worksheet
12
13worksheet.getCells().deleteRows(2,1,True)
14
15\# Saving the modified Excel file in default (that is Excel 2003) format
16
17workbook.save(self.dataDir + "Delete Row.xls")
18
19print "Delete Row Successfully."