"""Check exact measure names from By POS & SE file""" import sys, os, openpyxl folder = r'C:\Users\Professional\Desktop\kpi_dashboard\import_excel' fname = [f for f in os.listdir(folder) if 'POS' in f and 'SE' in f and 'store' not in f.lower()][0] wb = openpyxl.load_workbook(os.path.join(folder, fname), data_only=True) ws = wb.active rows = list(ws.iter_rows(values_only=True)) found = set() for row in rows[3:]: mn = str(row[5]).strip() if row[5] else '' if not mn or mn in found: continue found.add(mn) # Check if the measure name contains unusual characters has_special = any(ord(c) > 127 for c in mn) if has_special: print(f"SPECIAL: {mn!r}") print(f" hex: {' '.join(f'{ord(c):04x}' for c in mn)}") # Find our specific targets print("\n--- Looking for key measures ---") for mn in sorted(found): if 'LAS' in mn and 'Sale' in mn: print(f"FOUND LAS+Sales: {mn!r}") print(f" hex: {' '.join(f'{ord(c):04x}' for c in mn)}") if 'Open Lendings' in mn and 'LAS' in mn: print(f"FOUND Open LAS: {mn!r}") if 'HTS carton' in mn.lower(): print(f"FOUND HTS carton: {mn!r}") if 'Sales' in mn and 'w/o HTS' in mn: print(f"FOUND w/o HTS: {mn!r}")