mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-26 09:13:58 -04:00
Merge pull request #4244 from alphagov/xlrd-2
Upgrade xlrd to version 2 and force `.xlsm` files to open with pyexcel-xlsx instead
This commit is contained in:
@@ -3,6 +3,7 @@ from io import StringIO
|
|||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
import pyexcel
|
import pyexcel
|
||||||
|
import pyexcel_xlsx
|
||||||
|
|
||||||
|
|
||||||
class Spreadsheet():
|
class Spreadsheet():
|
||||||
@@ -72,6 +73,15 @@ class Spreadsheet():
|
|||||||
file_content = StringIO(
|
file_content = StringIO(
|
||||||
Spreadsheet.normalise_newlines(file_content))
|
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(
|
instance = cls.from_rows(
|
||||||
pyexcel.iget_array(
|
pyexcel.iget_array(
|
||||||
file_type=extension,
|
file_type=extension,
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ lml==0.1.0
|
|||||||
# via
|
# via
|
||||||
# pyexcel
|
# pyexcel
|
||||||
# pyexcel-io
|
# pyexcel-io
|
||||||
lxml==4.6.5
|
lxml==4.8.0
|
||||||
# via
|
# via
|
||||||
# pyexcel-ezodf
|
# pyexcel-ezodf
|
||||||
# pyexcel-ods3
|
# pyexcel-ods3
|
||||||
@@ -119,7 +119,7 @@ notifications-python-client==6.3.0
|
|||||||
# via -r requirements.in
|
# via -r requirements.in
|
||||||
notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@55.1.6
|
notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@55.1.6
|
||||||
# via -r requirements.in
|
# via -r requirements.in
|
||||||
openpyxl==3.0.7
|
openpyxl==3.0.9
|
||||||
# via pyexcel-xlsx
|
# via pyexcel-xlsx
|
||||||
orderedset==2.0.3
|
orderedset==2.0.3
|
||||||
# via notifications-utils
|
# via notifications-utils
|
||||||
@@ -205,7 +205,7 @@ smartypants==2.0.1
|
|||||||
# via notifications-utils
|
# via notifications-utils
|
||||||
statsd==3.3.0
|
statsd==3.3.0
|
||||||
# via notifications-utils
|
# via notifications-utils
|
||||||
texttable==1.6.3
|
texttable==1.6.4
|
||||||
# via pyexcel
|
# via pyexcel
|
||||||
urllib3==1.26.5
|
urllib3==1.26.5
|
||||||
# via
|
# via
|
||||||
@@ -222,7 +222,7 @@ wtforms==3.0.1
|
|||||||
# via
|
# via
|
||||||
# -r requirements.in
|
# -r requirements.in
|
||||||
# flask-wtf
|
# flask-wtf
|
||||||
xlrd==1.2.0
|
xlrd==2.0.1
|
||||||
# via pyexcel-xls
|
# via pyexcel-xls
|
||||||
xlwt==1.3.0
|
xlwt==1.3.0
|
||||||
# via pyexcel-xls
|
# via pyexcel-xls
|
||||||
|
|||||||
Reference in New Issue
Block a user