0

i read data from tables in pptx, and want to write to excel, but i found that if the cell have '\u000b', the openpyxl throws such error.

  File "D:\Python37\lib\site-packages\openpyxl\worksheet\worksheet.py", line 240, in cell
    cell.value = value
  File "D:\Python37\lib\site-packages\openpyxl\cell\cell.py", line 216, in value
    self._bind_value(value)
  File "D:\Python37\lib\site-packages\openpyxl\cell\cell.py", line 192, in _bind_value
    value = self.check_string(value)
  File "D:\Python37\lib\site-packages\openpyxl\cell\cell.py", line 159, in check_string
    raise IllegalCharacterError
openpyxl.utils.exceptions.IllegalCharacterError

i try to covert it using value=unicodedata.normalize("NFKD", value), it has no effect

  • That's a line tab. You may find it easier to just strip it. – hrokr Jul 15 '20 at 03:01
  • Does this answer your question? [How to remove illegal characters so a dataframe can write to Excel](https://stackoverflow.com/questions/42306755/how-to-remove-illegal-characters-so-a-dataframe-can-write-to-excel) – jdaz Jul 15 '20 at 03:01
  • The problem is that the character cannot be converted correctly to XML so you get the exception early and the chance to do something about it. – Charlie Clark Jul 15 '20 at 08:15

0 Answers0