How to open an Excel file with encoding in .NET Core?

4 Nov 20251 minute to read

XlsIO do not have direct support to open an Excel file with encoding in .NET Core. But this can be acheived through below workaround.

using (ExcelEngine excelEngine = new ExcelEngine())
{
  IApplication application = excelEngine.Excel;

  System.Text.UnicodeEncoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
  IWorkbook workbook = application.Workbooks.Open("Sample.csv", System.Text.UnicodeEncoding.GetEncoding("big5"));

  workbook.SaveAs("Output.csv", ",");
}