Detect ASIN column index dynamically from headers

This commit is contained in:
Christian Vidal Wolf
2026-04-09 16:29:54 +02:00
parent 9c73efa8cf
commit 4a6440f58a
+8
View File
@@ -77,6 +77,14 @@ export default function App() {
const rawHeaders = data[0]; const rawHeaders = data[0];
const rawRows = data.slice(1); const rawRows = data.slice(1);
// Find ASIN column index from headers (case insensitive)
const asinIdx = (rawHeaders as string[]).findIndex((h: string) =>
String(h).toLowerCase().trim() === 'asin'
);
if (asinIdx !== -1) {
console.log('ASIN column found at index:', asinIdx);
}
console.log('Applying Supabase overrides...'); console.log('Applying Supabase overrides...');
const syncedData = await getAllSyncedRows(); const syncedData = await getAllSyncedRows();
const articleNoIdx = COLUMNS.ARTICLE_NO; const articleNoIdx = COLUMNS.ARTICLE_NO;