# -*- coding: utf-8 -*- import openpyxl, os tmp = r'C:\Users\jcxiong\AppData\Local\Temp\ta_e2e_524cecf1' wb = openpyxl.load_workbook(os.path.join(tmp, 'gen_freight_rank.xlsx')) ws = wb[wb.sheetnames[0]] print('max_row:', ws.max_row, 'max_col:', ws.max_column) for r in [2,3,4,5,6,24,25,26,27,28,44,45,46,47]: cells = [(c.coordinate, c.value) for c in ws[r] if c.value is not None] print(r, '->', cells[:3])