I want to count the rows & columns present in an Excel table using a loop, and the loop should stop running on encountering 2 (or more) consecutive empty cells.
row_count=0
col_count=0
for a in range(1,temp.max_row+1):
if temp.cell(row=a,column=2).value!=None:
row_count= row_count+1
else:
break
for b in range(2,temp.max_column+1):
if temp.cell(row=8,column=b).value!=None:
col_count=col_count+1
else:
break
print(row_count)
print(col_count)
However, I cant get a correct result with the method used.