
import openpyxl
import pandas as pd
import os

file_path = 'src/data/Code Search 2024_Shop.xlsx'

print(f"Loading {file_path}...")
wb = openpyxl.load_workbook(file_path, data_only=False)

print("Sheets:", wb.sheetnames)

for sheet_name in wb.sheetnames:
    print(f"\n--- Analysis of Sheet: {sheet_name} ---")
    sheet = wb[sheet_name]
    
    # Check for formulas
    formula_count = 0
    formulas = []
    
    for row in sheet.iter_rows(max_row=200): # Limit to first 200 rows for speed
        for cell in row:
            if cell.value and isinstance(cell.value, str) and cell.value.startswith('='):
                formula_count += 1
                formulas.append(f"{cell.coordinate}: {cell.value}")
    
    print(f"Found {formula_count} formulas (showing first 20):")
    for f in formulas[:20]:
        print(f)

    # Check for likely inputs (cells without formulas but with labels nearby?)
    # This is hard to detect automatically, but let's print some content
    print("\n--- Sample Content (First 20 rows) ---")
    data = []
    for row in sheet.iter_rows(min_row=1, max_row=20, values_only=True):
        print(row)

