From 69f44569426de45c400b59a60719192842aedcb5 Mon Sep 17 00:00:00 2001 From: Christian Vidal Wolf Date: Mon, 23 Feb 2026 18:18:02 +0100 Subject: [PATCH] feat: force ASIN and SKU columns in Grid exports --- services/dataProcessor.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/services/dataProcessor.ts b/services/dataProcessor.ts index 98dabfe..3a0b1c5 100644 --- a/services/dataProcessor.ts +++ b/services/dataProcessor.ts @@ -1541,14 +1541,18 @@ export const generateXLSX = (rows: PivotRow[], dimensions: string[], years: stri const flatData = rows.map(row => { const flatRow: any = {}; - // Add Dimension Columns + // Always ensure ASIN and SKU are exported as foundational identifiers + flatRow['ASIN'] = row.asin || '-'; + flatRow['SKU'] = row.sku || '-'; + + // Add User Selected Dimension Columns dimensions.forEach(dim => { + if (dim.toLowerCase() === 'asin' || dim.toLowerCase() === 'sku') return; // Skip if already explicitly set + let header = dim; if (dim === 'line') header = 'Product Line'; if (dim === 'title') header = 'Title'; if (dim === 'customer') header = 'Customer'; - if (dim === 'sku' || dim === 'SKU') header = 'SKU'; - if (dim === 'asin' || dim === 'ASIN') header = 'ASIN'; flatRow[header] = row[dim as keyof PivotRow]; });