diff --git a/app/models/spreadsheet.py b/app/models/spreadsheet.py index 7b66a7b0f..59ca2bdd7 100644 --- a/app/models/spreadsheet.py +++ b/app/models/spreadsheet.py @@ -3,6 +3,7 @@ from io import StringIO from os import path import pyexcel +import pyexcel_xlsx class Spreadsheet(): @@ -72,6 +73,15 @@ class Spreadsheet(): file_content = StringIO( Spreadsheet.normalise_newlines(file_content)) + if extension == 'xlsm': + file_data = pyexcel_xlsx.get_data(file_content) + instance = cls.from_rows( + # Get the first sheet from the workbook + list(file_data.values())[0], + filename, + ) + return instance + instance = cls.from_rows( pyexcel.iget_array( file_type=extension, diff --git a/requirements.txt b/requirements.txt index f09debcb3..7457048f0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -105,7 +105,7 @@ lml==0.1.0 # via # pyexcel # pyexcel-io -lxml==4.6.5 +lxml==4.8.0 # via # pyexcel-ezodf # pyexcel-ods3 @@ -119,7 +119,7 @@ notifications-python-client==6.3.0 # via -r requirements.in notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@55.1.6 # via -r requirements.in -openpyxl==3.0.7 +openpyxl==3.0.9 # via pyexcel-xlsx orderedset==2.0.3 # via notifications-utils @@ -205,7 +205,7 @@ smartypants==2.0.1 # via notifications-utils statsd==3.3.0 # via notifications-utils -texttable==1.6.3 +texttable==1.6.4 # via pyexcel urllib3==1.26.5 # via @@ -222,7 +222,7 @@ wtforms==3.0.1 # via # -r requirements.in # flask-wtf -xlrd==1.2.0 +xlrd==2.0.1 # via pyexcel-xls xlwt==1.3.0 # via pyexcel-xls