Merge pull request #27313 from frappe/sheet_title_fix

remove unsupported characters from sheet title
This commit is contained in:
Sumit Bhanushali 2024-08-05 18:20:58 +05:30 committed by GitHub
commit f47dd1253b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,6 +8,7 @@ import xlrd
from openpyxl import load_workbook
from openpyxl.styles import Font
from openpyxl.utils import get_column_letter
from openpyxl.workbook.child import INVALID_TITLE_REGEX
import frappe
from frappe.utils.html_utils import unescape_html
@ -21,7 +22,8 @@ def make_xlsx(data, sheet_name, wb=None, column_widths=None):
if wb is None:
wb = openpyxl.Workbook(write_only=True)
ws = wb.create_sheet(sheet_name, 0)
sheet_name_sanitized = INVALID_TITLE_REGEX.sub(" ", sheet_name)
ws = wb.create_sheet(sheet_name_sanitized, 0)
for i, column_width in enumerate(column_widths):
if column_width: