Python uses xlwt to report an error string longer than 32767 characters
The xlwt module is used to write xlsx files in the project. Today, we encountered the error of string longer than 32767 characters. Through consulting the data, we found that excel cells support 32767 characters at most. Finally, we got two solutions xlsxwriter and openpyxl
At first, I used openpyxl to write Excel files. I found that if there are some special characters in the cell content, an openpyxl.utils.exceptions.illegalcharactererror error error will be thrown. I used pandas.to_Excel also throws the same error, indicating pandas.to_Excel also uses the openpyxl method by default. If special characters can be controlled manually, they can be processed by themselves. If not, they have to use the xlsxwriter method
Xlsxwriter is similar to xlwt. It truncates when the cell character size exceeds 32767, so no error will be reported
Similar Posts:
- Python: How to Batch Read the Form Information in Word and output them to Excel file
- Python Pandas: Read_Excel() and to_Excel() function
- [Solved] java.lang.IllegalStateException: Cannot get a STRING value from a NUMERIC cell
- The problem of error reporting when importing openpyxl from Python has finally been solved
- Problems and solutions of typeerror: ‘generator’ object is not subscriptable in openpyxl
- BadZipFile: File is not a zip file [How to Solve]
- Spring MVC upload file error string cannot be converted to multipartfile
- [Solved] The length of the data truncation done by springboothinesdata for the column.
- XML parsing & special character error
- [Solved] error: ‘gets’ was not declared in this scope; did you mean ‘fgets’?