import ExcelJS from "exceljs";

async function inspect() {
  const wb = new ExcelJS.Workbook();
  await wb.xlsx.readFile("C:/Users/timo/Downloads/Belege_Export_2026-08-14.xlsx");

  console.log("=== WORKBOOK SHEETS ===");
  wb.eachSheet((sheet, id) => {
    console.log(`Sheet ${id}: "${sheet.name}" (Rows: ${sheet.rowCount}, Cols: ${sheet.columnCount})`);
  });

  const s1 = wb.getWorksheet("Belegübersicht");
  if (s1) {
    console.log("\n=== SHEET 1: Belegübersicht ===");
    s1.eachRow((row, rowNumber) => {
      console.log(`Row ${rowNumber}:`, JSON.stringify(row.values));
    });
  }

  const s2 = wb.getWorksheet("Einzelpositionen Detail");
  if (s2) {
    console.log("\n=== SHEET 2: Einzelpositionen Detail ===");
    s2.eachRow((row, rowNumber) => {
      console.log(`Row ${rowNumber}:`, JSON.stringify(row.values));
    });
  }
}

inspect().catch(console.error);
