mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 12:25:22 +02:00
26 lines
876 B
JavaScript
26 lines
876 B
JavaScript
const XLSX = require('xlsx');
|
|
const path = require('path');
|
|
|
|
function inspectForecast(filename, targetSku) {
|
|
const filePath = path.join(process.cwd(), 'public', filename);
|
|
const workbook = XLSX.readFile(filePath);
|
|
const sheetName = workbook.SheetNames[0];
|
|
const sheet = workbook.Sheets[sheetName];
|
|
const data = XLSX.utils.sheet_to_json(sheet);
|
|
|
|
console.log(`Searching for SKU: ${targetSku} in ${filename}`);
|
|
const results = data.filter(row =>
|
|
String(row['SKU'] || row['sku'] || '').includes(targetSku) ||
|
|
String(row['ASIN'] || row['asin'] || '').includes(targetSku)
|
|
);
|
|
|
|
if (results.length === 0) {
|
|
console.log('No results found.');
|
|
} else {
|
|
results.forEach(r => console.log(JSON.stringify(r, null, 2)));
|
|
}
|
|
}
|
|
|
|
const targetSku = process.argv[2] || '46234';
|
|
inspectForecast('fc UK 26.xlsx', targetSku);
|