I am trying to use ExcelDataReader to read an .xls file on Ubuntu. I am using VS Code with C#. Here is the code:
var stream = File.Open(filePath, mode: FileMode.Open, access: FileAccess.Read);
var reader = ExcelReaderFactory.CreateReader(stream);
I also tried this:
var reader = ExcelDataReader.ExcelReaderFactory.CreateBinaryReader(stream);
When I run, I am getting the following exception:
Unhandled Exception: System.NotSupportedException: No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. at System.Text.Encoding.GetEncoding(Int32 codepage)
I already installed the libmono-i18n-west4.0-cil
(tried also with libmono-i18n4.0-all
) as I found out some people recommending this, but the problem persists. Also installed the package System.Text.Encoding.CodePages
without success.
Can anyone help to solve this?
System.Text.Encoding.CodePages
... installed, or installed and registered? – Dap<PackageReference Include="System.Text.Encoding.CodePages" Version="4.4.0" />
). – AlidisEncoding.RegisterProvider(CodePagesEncodingProvider.Instance);
This answer suggests that this is required. – Dap