import os
import openpyxl

file_path = r"c:\laragon6\www\triwala-office\Slip gaji Juni 2026.xlsx"
if not os.path.exists(file_path):
    print(f"File not found: {file_path}")
    exit(1)

wb = openpyxl.load_workbook(file_path, data_only=False)
print("Sheet names:", wb.sheetnames)

for sheet_name in wb.sheetnames:
    ws = wb[sheet_name]
    print(f"\n--- Sheet: {sheet_name} (Max row: {ws.max_row}, Max col: {ws.max_column}) ---")
    # Display the first 25 rows and 20 columns
    for r in range(1, min(ws.max_row + 1, 40)):
        row_vals = []
        for c in range(1, min(ws.max_column + 1, 20)):
            cell = ws.cell(row=r, column=c)
            val = cell.value
            if val is not None:
                # If it's a formula, print the formula text
                row_vals.append(f"{openpyxl.utils.get_column_letter(c)}{r}: {val}")
        if row_vals:
            print(", ".join(row_vals))

print("\n--- Reading styles ---")
ws = wb.active
for r in [1, 2, 3]:
    for c in [1, 2, 3, 4, 5]:
        cell = ws.cell(row=r, column=c)
        print(f"Cell {openpyxl.utils.get_column_letter(c)}{r}: font={cell.font.name if cell.font else None}, bold={cell.font.bold if cell.font else None}, fill={cell.fill.fill_type if cell.fill else None}, value={cell.value}")
