diff --git a/services/dataProcessor.ts b/services/dataProcessor.ts index e29f3ab..159d2a1 100644 --- a/services/dataProcessor.ts +++ b/services/dataProcessor.ts @@ -2260,14 +2260,16 @@ export const processBuyBoxExcel = async (fileOrBuffer: File | ArrayBuffer): Prom }); } - // Fallback to previous hardcoded indices if header search fails - if (reasonIdx === -1) { - if (config.country === 'FR') reasonIdx = 18; - else if (config.country === 'UK') reasonIdx = 9; - else if (config.country === 'DE') reasonIdx = 13; - else if (config.country === 'IT') reasonIdx = 12; - else if (config.country === 'ES') reasonIdx = 13; - else reasonIdx = 13; + // Fallback to previous hardcoded indices if header search fails or for specific known sheet structures + if (reasonIdx === -1 || (config.country === 'FR' && reasonIdx !== 18)) { + if (config.country === 'FR') reasonIdx = 18; // Force Column S for FR + else if (reasonIdx === -1) { + if (config.country === 'UK') reasonIdx = 9; + else if (config.country === 'DE') reasonIdx = 13; + else if (config.country === 'IT') reasonIdx = 12; + else if (config.country === 'ES') reasonIdx = 13; + else reasonIdx = 13; + } } console.log(`[BuyBox] Sheet "${sheetName}" (Country: ${config.country}): HeaderRow=${headerRowIdx}, ASIN Col=${finalAsinIdx} ("${headers[finalAsinIdx]}"), Reason Col=${reasonIdx} ("${headers[reasonIdx] || 'N/A'}")`);