mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 16:15:24 +02:00
31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
import XLSX from 'xlsx';
|
|
import { readFileSync } from 'fs';
|
|
|
|
const buf = readFileSync('/tmp/Ads-Weekly.xlsx');
|
|
const wb = XLSX.read(buf, { type: 'buffer' });
|
|
|
|
console.log('=== SHEETS:', wb.SheetNames, '\n');
|
|
|
|
for (const sheetName of wb.SheetNames) {
|
|
const ws = wb.Sheets[sheetName];
|
|
const rows: any[] = XLSX.utils.sheet_to_json(ws, { defval: '' });
|
|
|
|
const weeks = [...new Set(rows.map((r: any) => r.Week))].sort((a: any, b: any) => a - b);
|
|
console.log(`Sheet ${sheetName}: ${rows.length} rows | weeks ${weeks[0]} to ${weeks[weeks.length - 1]}`);
|
|
|
|
const inkeeRows = rows.filter((r: any) =>
|
|
String(r.ASIN || '').toUpperCase().startsWith('B0CQ')
|
|
);
|
|
if (inkeeRows.length > 0) {
|
|
console.log(` INKEE rows: ${inkeeRows.length}`);
|
|
console.log(' First INKEE row:', JSON.stringify(inkeeRows[0]));
|
|
const inkeeWeeks = [...new Set(inkeeRows.map((r: any) => r.Week))].sort((a: any, b: any) => a - b);
|
|
console.log(' INKEE weeks:', inkeeWeeks.join(', '));
|
|
} else {
|
|
console.log(` No INKEE rows (B0CQ...) in ${sheetName}`);
|
|
const deRows = rows.filter((r: any) => String(r.Country || '') === 'DE');
|
|
const uniqueAsins = [...new Set(deRows.map((r: any) => r.ASIN))].slice(0, 8);
|
|
console.log(' Some DE ASINs:', uniqueAsins.join(', '));
|
|
}
|
|
}
|