From 193b840da290b0f50818158541020efb10e68e4d Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 7 Jul 2018 12:43:55 +0200 Subject: [PATCH] Open xlsx workbooks in read-only mode Refs #316 --- tablib/formats/_xlsx.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tablib/formats/_xlsx.py b/tablib/formats/_xlsx.py index ebafc4f3..6cbc88bb 100644 --- a/tablib/formats/_xlsx.py +++ b/tablib/formats/_xlsx.py @@ -70,7 +70,7 @@ def import_set(dset, in_stream, headers=True): dset.wipe() - xls_book = openpyxl.reader.excel.load_workbook(BytesIO(in_stream)) + xls_book = openpyxl.reader.excel.load_workbook(BytesIO(in_stream), read_only=True) sheet = xls_book.active dset.title = sheet.title @@ -88,7 +88,7 @@ def import_book(dbook, in_stream, headers=True): dbook.wipe() - xls_book = openpyxl.reader.excel.load_workbook(BytesIO(in_stream)) + xls_book = openpyxl.reader.excel.load_workbook(BytesIO(in_stream), read_only=True) for sheet in xls_book.worksheets: data = tablib.Dataset()