"""Inspect the three new VrstaRabatnePolitike files."""
import sys
sys.stdout.reconfigure(encoding="utf-8")
from pathlib import Path
import pandas as pd

files = [
    "data/VrstaRabatnePolitike 05.xlsx",
    "data/VrstaRabatnePolitike06.xlsx",
    "data/VrstaRabatnePolitikesummer buddy.xlsx",
]

for fp in files:
    p = Path(fp)
    print(f"=== {p.name} ===")
    if not p.exists():
        print("  NOT FOUND")
        continue
    try:
        # Try first sheet
        xls = pd.ExcelFile(p)
        print(f"  sheets: {xls.sheet_names}")
        for sheet in xls.sheet_names:
            df = pd.read_excel(p, sheet_name=sheet)
            print(f"  --- sheet={sheet!r} ({len(df)} rows, {len(df.columns)} cols)")
            print(f"      columns: {list(df.columns)}")
            print(f"      first 8 rows:")
            try:
                print(df.head(8).to_string(max_cols=12))
            except Exception:
                print("      (display failed)")
            print()
    except Exception as e:
        print(f"  ERROR: {e}")
    print()
