none
OLDEB data provider RRS feed

  • Question

  • Hi I am trying to read data from Excel 2013 file(.xlsx). I am getting error

    "External table is not in correct format".

    connnection string is

    string excelConnStr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filelocation + ";Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1;\";";

    Please help me out


    Shubho

    • Moved by Kristin Xie Friday, July 24, 2015 5:34 AM move to better forum
    Thursday, July 23, 2015 12:57 PM

All replies

  • Can you try to read another dummy file and check what will happen? How that excel file which failed to read is created?

    Fouad Roumieh

    Thursday, July 23, 2015 1:19 PM
  • I believe that you need to specify Xml in the connection string for an .xlsx file:

    string excelConnStr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filelocation + ";Extended Properties=\"Excel 12.0 Xml;HDR=YES;IMEX=1;\";";


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Friday, July 24, 2015 11:43 AM
  • Hi Paul,

    I have tried that.Nothing gives gold:)

    What ever Connection string, I have used ,that is working for .xla format, not for .xlx or .xlsx.

    I think for each and every format connection string should be different.

    Can you please tell me what should be connection string for each format


    Shubho

    Friday, July 31, 2015 5:54 AM
  • Does the Workbook contain any charts, images or complex formulas?

    You can find connection string examples at the below link:

    https://www.connectionstrings.com/excel/


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Friday, July 31, 2015 1:08 PM
  • There is no images or charts. 

    I have tried all the connection strings. unfortunately nothing gives gold


    Shubho

    Friday, July 31, 2015 6:49 PM