feat: Make Buy Box sheet matching even more aggressive

This commit is contained in:
Christian Vidal Wolf
2026-02-05 08:48:27 +01:00
parent 4ead042534
commit aeefd76496
+3 -2
View File
@@ -2164,11 +2164,12 @@ export const processBuyBoxExcel = async (fileOrBuffer: File | ArrayBuffer): Prom
console.log('[BuyBox] Available sheets:', workbook.SheetNames.join(', '));
for (const config of BB_SHEET_CONFIG) {
// Find sheet case-insensitively and with flexible separators (BB_ES, BB-ES, BB ES)
// Find sheet case-insensitively and with flexible separators (BB_ES, BB-ES, BB ES, ES BB)
const sheetName = workbook.SheetNames.find(name => {
const n = name.toUpperCase().replace(/[-_ ]/g, '');
const target = config.sheet.toUpperCase().replace(/[-_ ]/g, '');
return n === target;
// Also match if the sheet is just the country code or contains 'BB' and the country code
return n === target || n === config.country || (n.includes('BB') && n.includes(config.country));
});
if (!sheetName) {