Reading CSV File with Multiple Encodings

Aspose.Cells provides the TxtLoadOptions.IsMultiEncoded property, which you need to set to true to load your CSV file with multiple encodings properly.

The following screenshot shows a sample CSV file that contains two lines. The first line is in ANSI encoding and the second line is in Unicode encoding

Input file
todo:image_alt_text

The following screenshot shows the XLSX file converted from the above CSV file without setting the TxtLoadOptions.IsMultiEncoded property to true. As you can see, the Unicode text was not converted properly.

Output file 1: no accommodation made for multiple encoding
todo:image_alt_text

The following screenshot shows the XSLX file converted from the above CSV file after setting the TxtLoadOptions.IsMultiEncoded property to true. As you can see, the Unicode text is now converted properly.

Output file 2: IsMultiEncoded is set to true
todo:image_alt_text

Below is the sample code that converts the above CSV file into XLSX format properly.