Dear, All.
If cells (i,5) does not have value, I want to delete the row in excel with python pywin32 at python 3.6.
this is my code.
def qms(self):
fname = QtWidgets.QFileDialog.getOpenFileName(self)
if fname[0]:
self.Filename.setText(fname[0])
excel = win32com.client.Dispatch("Excel.Application")
excel.Visible = True
f = excel.Workbooks.Open(fname[0])
fs = f.ActiveSheet
lastrow = fs.UsedRange.Rows.Count
for i in range(3, lastrow):
if not fs.Cells(i,5).Value :
fs.getCells().deleteRows(i-1,1,True)
excel.Workbooks.save()
excel.Quit()
I think there are problem in fs.getCells().deleteRow(i-1,1,True). I cannot understand. could you help me?