Merge pull request #27313 from frappe/sheet_title_fix
remove unsupported characters from sheet title
This commit is contained in:
commit
f47dd1253b
1 changed files with 3 additions and 1 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue