import json
from openpyxl import load_workbook

excel_path = r'f:\laravel\job\abality - Copy\public\ABILITY_PRICE_LIST_2026-1.xlsx'
wb = load_workbook(excel_path)

all_images = []

for sheet_name in wb.sheetnames:
    ws = wb[sheet_name]
    if hasattr(ws, '_images'):
        for i, img in enumerate(ws._images):
            anchor = img.anchor
            # Anchor can be TwoCellAnchor or OneCellAnchor
            # _from is the start cell
            start_row = anchor._from.row
            start_col = anchor._from.col
            
            # If TwoCellAnchor, there is a _to
            to_row = anchor.to.row if hasattr(anchor, 'to') and anchor.to else None
            to_col = anchor.to.col if hasattr(anchor, 'to') and anchor.to else None
            
            all_images.append({
                "sheet": sheet_name,
                "index": i,
                "from_row": start_row,
                "from_col": start_col,
                "to_row": to_row,
                "to_col": to_col
            })

with open(r'f:\laravel\job\abality - Copy\scratch\all_images_debug.json', 'w', encoding='utf-8') as f:
    json.dump(all_images, f, ensure_ascii=False, indent=4)

print(f"Total images found: {len(all_images)}")
