Project Files
scripts / debug-excel.ts
// debug-excel.ts
import { Database } from "duckdb";
import * as readline from "readline";
import { loadExcelIntoDuckDb } from "../src/utils/excel/loadExcel";
async function main() {
const filePath = process.argv[2];
if (!filePath) { console.error("Usage: ts-node debug-excel.ts <path-to-xlsx>"); process.exit(1); }
const db = new Database(":memory:");
await loadExcelIntoDuckDb(db, { name: filePath, getFilePath: async () => filePath } as any);
const rl = readline.createInterface({ input: process.stdin, output: process.stdout, prompt: "sql> " });
rl.prompt();
rl.on("line", (line) => {
db.all(line, (err, rows) => {
if (err) console.error("Error:", err.message);
else console.table(rows);
rl.prompt();
});
});
}
main();