dilshod / xlsx2csv

Convert xslx to csv, it is fast, and works for huge xlsx files
MIT License
1.64k stars 302 forks source link

hyperlinks crash string bytes #248

Closed NoSuck closed 1 year ago

NoSuck commented 1 year ago

Thank you for the useful utility.

This change prevents the following crash that occurs when invoked with the --hyperlinks option:

Traceback (most recent call last):
  File "./xlsx2csv.py", line 1214, in <module>
    main()
  File "./xlsx2csv.py", line 1207, in main
    xlsx2csv.convert(outfile, sheetid)
  File "./xlsx2csv.py", line 234, in convert
    self._convert(sheetid, outfile)
  File "./xlsx2csv.py", line 352, in _convert
    re.sub(r"(<v>[^<>]+)&#13;([^<>]+</v>)", r"\1\\r\2", sheet.filedata)))
  File "/usr/lib64/python3.10/re.py", line 209, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: cannot use a string pattern on a bytes-like object