Open .xlsb with ExcelDataReader

529 Views Asked by At

ExcelDataReader documentation says that it can open .xlsb files.

using (var stream = File.Open(filePath, FileMode.Open, FileAccess.Read))
{
    // Auto-detect format, supports:
    //  - Binary Excel files (2.0-2003 format; *.xls)
    //  - OpenXml Excel files (2007 format; *.xlsx, *.xlsb)
    using (var reader = ExcelReaderFactory.CreateReader(stream))
    {
        // Choose one of either 1 or 2:

        // 1. Use the reader methods
        do
        {
            while (reader.Read())
            {
                // reader.GetDouble(0);
            }
        } while (reader.NextResult());

        // 2. Use the AsDataSet extension method
        var result = reader.AsDataSet();

        // The result of each spreadsheet is in result.Tables
    }
}

But when I try to open a .xlsb stream, it gives an error saying that it can't open a zip file.

I have tried to see if any free third party lib that can convert xlsb to XLS, without any luck.

0

There are 0 best solutions below