26 lines
1.2 KiB
TypeScript
26 lines
1.2 KiB
TypeScript
// @deno-types="https://cdn.sheetjs.com/xlsx-0.20.3/package/types/index.d.ts"
|
|
import * as XLSX from "https://cdn.sheetjs.com/xlsx-0.20.3/package/xlsx.mjs";
|
|
|
|
for (const file of ["FISE-INFO-2025.xlsx", "FISA-INFO-2025.xlsx"]) {
|
|
console.log(`\n=== ${file} ===`);
|
|
const wb = XLSX.read(Deno.readFileSync(`Excels/${file}`), { type: "array" });
|
|
console.log(`Sheets: ${wb.SheetNames.join(", ")}`);
|
|
|
|
for (const sheetName of wb.SheetNames) {
|
|
console.log(`\n--- Sheet: ${sheetName} ---`);
|
|
const sheet = wb.Sheets[sheetName];
|
|
const rows = XLSX.utils.sheet_to_json<(string | number | null)[]>(sheet, { header: 1 });
|
|
// Print first 5 cols of each row, mark rows that look like year/semester headers
|
|
for (let i = 0; i < rows.length; i++) {
|
|
const row = rows[i];
|
|
if (!row || row.length === 0) continue;
|
|
const col0 = row[0] != null ? String(row[0]).trim() : "";
|
|
// Show rows that are structural (year, semester, UE headers)
|
|
if (col0 || (row[1] != null && String(row[1]).trim())) {
|
|
const preview = row.slice(0, 6).map(c => c != null ? String(c).substring(0, 25) : "").join(" | ");
|
|
console.log(` [${i}] ${preview}`);
|
|
}
|
|
}
|
|
}
|
|
}
|