Cant figure out why the break is not working below: Loaded the already existed excel file using openpyxl.
I tried printing the values before break, and it does print the row values that are empty. This confirms that the inside of loop is executed.
def x(ws):
for row in ws.iter_rows(min_row=11,max_row=50,min_col=4,max_col=4):
for cell in row:
if cell.value is None:
next_index=int(cell.row)
break
print('The return is: ')
print(next_index)
return next_index
All I want is exit the loop with the first cell empty on that range but instead getting the last row i.e 50 return, where as expected return is 11.