System.NotSupportedException: No data is available for encoding 1252

What ckuri said. Just to be clear, you need the following line of code before opening the stream (steps 2,3):

System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);

ExcelDataReader – Important note on .NET Core

By default, ExcelDataReader throws a NotSupportedException “No data is
available for encoding 1252.” on .NET Core.

To fix, add a dependency to the package System.Text.Encoding.CodePages
and then add code to register the code page provider during
application initialization (f.ex in Startup.cs):

System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);

This is required to parse strings in binary BIFF2-5 Excel documents
encoded with DOS-era code pages. These encodings are registered by
default in the full .NET Framework, but not on .NET Core.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)