From 78d7575886b3aa9b0119e262639cadb4778a67ea Mon Sep 17 00:00:00 2001 From: Christian Gill Date: Tue, 30 Jun 2020 15:38:14 +0200 Subject: [PATCH] allow rows to contain less data than columns suggest --- app/api/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/api/utils.py b/app/api/utils.py index 17182696..af84c460 100644 --- a/app/api/utils.py +++ b/app/api/utils.py @@ -385,10 +385,10 @@ class ExcelParser(FileParser): yield data data = [] # Only text column - if len(row) == len(columns) and len(row) == 1: - data.append({'text': row[0]}) + if len(row) <= len(columns) and len(row) == 1: + data.append({'text': row[0] }) # Text, labels and metadata columns - elif len(row) == len(columns) and len(row) >= 2: + elif len(row) <= len(columns) and len(row) >= 2: datum = dict(zip(columns, row)) text, label = datum.pop('text'), datum.pop('label') meta = FileParser.encode_metadata(datum)