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

    Read XLXS file import into datatable

    I am working on excel file, Read Excel file and import excel file data into datatable. It is working proper in case of XLS even one column value has(Example:TA123,AB678) but when i am using the XLSX extension then read XLXS file that time (Example:TA123,AB678) which rows has this type of code then it is showing blank column.

    I have already used this connection string:

    1. conn = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties='Excel 12.0;HDR=YES';";
    2. conn = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties='Excel 12.0;HDR=YES';IMEX=1\"";

    But not woring
  • #768906
    Hi nitin,

    Have you got any error, as I seen your connection is OK I suggest you to please check by debugging your code. If you got any error then let me know based on that we come to know the issue.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #768907
    In this screen shoot RS_ClientID is blank where Numeric number and character.
    Example:TA123,AB678

    RS_ClientID row is blank.

    PrintScreen.docx

    Delete Attachment

  • #768908
    Hi,

    Only problem with Numeric field means there is no problem with .xlsx, their might be different issue, please debug the code why numeric field is missed out while retrieve time, looping each entry...

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #768909
    Hi,

    You could also use Free Spire.XLS to achieve this task, which is pure and easy to use.
    https://www.nuget.org/packages/FreeSpire.XLS/
    Reference:
    https://www.e-iceblue.com/Tutorials/Spire.XLS/Spire.XLS-Program-Guide/Excel-Import/Export-Import-Data-from-Excel-to-Datatable.html

  • #768916
    Hai Nitin,
    This should work as the code is common for all the xlsx files. While reading, check the value is coming when you are building the data table. If the value is not coming, then check the type which you have mentioned for the data-table. Sometimes, the type mismatch will not get the data from the excel file.
    Hope it will be helpful to you.

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


  • Sign In to post your comments