You must Sign In to post a response.
  • Category: .NET

    How to read .xlsb file in c#

    How to read .xlsb file in c# could any one give perfect solution
  • #764303
    Hai Tamil,
    You can add the ExcelQueryFactory library from GitHub and then use its method to read the file. It also supports reading xls and xlsx files.
    Please follow below link for the code snippet:

    http://stackoverflow.com/questions/28398071/reading-excel-xlsb-files-in-c-sharp

    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com

  • #764308
    There are couple of ways to read XSLB file (XLS binary) format.
    1. LinqToExcel package is a liobrary that can useful to read it,
    you can download it from below path
    https://www.nuget.org/packages/LinqToExcel/
    2. ExcelDataReader is also a third party control which will use to read excel data, you can download package from
    https://github.com/ExcelDataReader/ExcelDataReader
    here is snippet
    var fileName = string.Format("{0}\\fileNameHere", Directory.GetCurrentDirectory());
    var connectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; data source={0}; Extended Properties=Excel 8.0;", fileName);

    var adapter = new OleDbDataAdapter("SELECT * FROM [workSheetNameHere$]", connectionString);
    var ds = new DataSet();

    adapter.Fill(ds, "anyNameHere");

    DataTable data = ds.Tables["anyNameHere"];

    3. Quick and simple fix is to use Interop object, see below snippet
    http://stackoverflow.com/questions/28398071/reading-excel-xlsb-files-in-c-sharp

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #764309
    Hi Pawan Awasthi and Prasad kulkarni

    I got this error message while using ExcelQueryFactory 'This file was created in a previous beta version of Excel 2007. Open the file with Excel 2007 to save it to the most recent version of the Excel 2007 file format before opening the file in Access 2007.'

  • #764310
    Hi,

    This this error arrives when you are trying to use an earlier version of an Microsoft office program to open a file that was saved in a 2007 program.

    You have to install Office 2007 Compatibility Pack.

    you can refer following URL(s):
    https://support.microsoft.com/en-us/kb/926054

    http://www.techrepublic.com/blog/microsoft-office/dont-get-derailed-by-office-2007-compatibility-issues/

    Hope it helps you.
    Regards,
    Shashikant Gurav
    shashikantgurav22@gmail.com

  • #764321
    Hai Tamil,
    If you are getting the error message 'This file was created in a previous beta version of Excel 2007. Open the file with Excel 2007 to save it to the most recent version of the Excel 2007 file format before opening the file in Access 2007.', Microsoft Has provided the fix for it. You need to download an utility and then open your file. Below is the link where you can get the utility and workaround to overcome this issue:

    https://support.microsoft.com/en-us/kb/926054

    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com

  • #764330
    Following are some tips to read the excel

    1. You can use "Microsoft.Office.Interop.Excel"

    2. install "PM> Install-Package LinqToExcel "
    and try to access your excel as follows

    using (var excelQueryFactory = new ExcelQueryFactory(filePath))
    {
    var YourWorksheet = excelQueryFactory.Worksheet("YourWorksheetName").Where("Your query");
    }

    By Nathan
    Direction is important than speed


Sign In to post your comments