Files
BoMtoCost/inspect_seout.py
David Rice 1ebd78f538 Finised
2026-05-05 15:02:49 +01:00

29 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""Quick diagnostic prints every sheet name, its headers, and 3 sample rows."""
from pathlib import Path
import openpyxl
path = Path("OCTO") / "seout.xlsx"
if not path.exists():
print(f"NOT FOUND: {path}")
raise SystemExit(1)
wb = openpyxl.load_workbook(path, data_only=True, read_only=True)
for sheet in wb.sheetnames:
ws = wb[sheet]
rows = list(ws.iter_rows(values_only=True))
print(f"\n=== Sheet: {sheet!r} ({len(rows)} rows) ===")
# Print first 15 rows so we can see past the metadata
for i, row in enumerate(rows[:15]):
vals = [v for v in row if v is not None]
if vals:
print(f" row {i+1}: {list(row)}")
# Also find any row that looks like a header (contains text with "part" or "mfg" or "price")
print("\n --- Searching for header row ---")
for i, row in enumerate(rows):
row_str = [str(v).lower() for v in row if v is not None]
if any("part" in v or "mfg" in v or "price" in v or "avg" in v for v in row_str):
print(f" row {i+1}: {list(row)}")
break
wb.close()