How can I convert a CSV file with :
delimiter to XLS (Excel sheet) using openpyxl
module?
Here is Adam's solution expanded to strip out characters that openpyxl considers illegal and will throw an exception for:
import re
from openpyxl.cell.cell import ILLEGAL_CHARACTERS_RE
...
##ws.append(row) - Replace with the code below
for i in row:
ws.append([ILLEGAL_CHARACTERS_RE.sub('',i)])
ILLEGAL_CHARACTERS_RE is a compiled regular expression containing the characters openpyxl deems "illegal". The code is simply substituting those characters with an empty string.
Source: Bitbucket openpyxl issue #873 - Remove illegal characters instead of throwing an exception