From 0bc85c7431384e1585f4236fcfb724184321eac2 Mon Sep 17 00:00:00 2001 From: Ben Cornwell-Mott Date: Sat, 23 Sep 2017 15:32:06 -0700 Subject: [PATCH] Allow workbook pass in make_xlsx --- frappe/utils/xlsxutils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frappe/utils/xlsxutils.py b/frappe/utils/xlsxutils.py index afd67cacaa..d4c4727299 100644 --- a/frappe/utils/xlsxutils.py +++ b/frappe/utils/xlsxutils.py @@ -12,9 +12,11 @@ from six import StringIO, string_types # return xlsx file object -def make_xlsx(data, sheet_name): +def make_xlsx(data, sheet_name, wb=None): + + if wb is None: + wb = openpyxl.Workbook(write_only=True) - wb = openpyxl.Workbook(write_only=True) ws = wb.create_sheet(sheet_name, 0) row1 = ws.row_dimensions[1]