From 5676a3dcf9eeef8ea5f6cc1873fb29652351aa33 Mon Sep 17 00:00:00 2001 From: Malin Date: Mon, 15 Jun 2026 17:03:57 +0200 Subject: [PATCH] fix: guard col I/J/K access for short rows in MTZ Excel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MTZ changed their Excel format — some rows have fewer than 10 columns, causing IndexError on row[9] (brand, col J). Use conditional indexing for cols I (8), J (9), K (10) so short rows parse with empty brand/type/min_box instead of crashing on startup. Co-Authored-By: Claude Sonnet 4.6 --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 7d9c67d..dc58985 100644 --- a/main.py +++ b/main.py @@ -90,10 +90,10 @@ def download_and_parse(): skipped += 1 continue - brand_raw = row[9] # col J + type_raw = row[8] if len(row) > 8 else None # col I + brand_raw = row[9] if len(row) > 9 else None # col J brand = str(brand_raw) if brand_raw is not None else "" - min_box_raw = row[10] # col K - type_raw = row[8] # col I + min_box_raw = row[10] if len(row) > 10 else None # col K product_type = re.sub(r'^\d+\.', '', str(type_raw)).strip() if type_raw is not None else "" description = re.sub(r'\s*\(\d+\).*$', '', raw_desc).strip() parsed.append(