Проблема следующего характера: нужно подсчитать кол-во непустых ячеек в столбце и вывести значение, НО в столбце могут быть пропущены несколько значений, и если они есть, то их все равно считать.
#!/usr/bin/env python # tries stress SST, SAT and MSAT from openpyxl import * wb = load_workbook(filename='VAS-1.xlsx', read_only=True) # open work book for processing ws = wb['list2'] # use this worksheet cell=0 def count_cells_with_data(row): if row is None: print('Argument is None') elif type(row) is not str: print('Error: '+str(row)+' this value is not string') else: i = 1 data = 0 result=row+str(i) while True: if ws[result].value is None: print('end') else: #ws[result].value is not None: data = data + 1 i = i + 1 result = row + str(i) # print(ws[result].value) print(data) print('end') count_cells_with_data('A')