import pandas as pd
import json
from openpyxl import load_workbook

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

# Load workbook to check for images
wb = load_workbook(excel_path)
ws = wb.active

images_found = []
if hasattr(ws, '_images'):
    for img in ws._images:
        images_found.append({
            "anchor": str(img.anchor),
            "col": img.anchor._from.col if hasattr(img.anchor, '_from') else None,
            "row": img.anchor._from.row if hasattr(img.anchor, '_from') else None
        })

df = pd.read_excel(excel_path, engine='openpyxl')

# Check for columns that might contain image info
full_preview = {
    "columns": df.columns.tolist(),
    "images_count": len(images_found),
    "sample_images": images_found[:5],
    "first_10_rows": df.head(10).to_dict(orient='records')
}

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

print(f"Detailed preview saved. Found {len(images_found)} images.")
