#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import glob
import os

import openpyxl

cands = glob.glob('/Users/liuxinyuan/Desktop/hermas输入-工作台数据库/**/*.xlsx', recursive=True)
for p in cands:
    try:
        wb = openpyxl.load_workbook(p, read_only=True, data_only=True)
        ws = wb.active
        head = next(ws.iter_rows(values_only=True))
        hs = [str(c) for c in head if c is not None]
        if any('商机' in h for h in hs):
            print(os.path.basename(p), '|', [h for h in hs if '商机' in h], '| 列数', len(hs))
    except Exception:
        continue
