OLEDB Connection String Fails RRS feed

  • Question

  • User-1725652363 posted

    I use OLEDB to read excel file, I have an Excel file with macro (.xlsm) for that I used this connector:

    string connexion_string = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + file + ";Extended Properties=\"Excel 12.0 Macro;HDR=YES;IMEX=1;\"";
                    OleDbConnection connexion = new OleDbConnection(connexion_string);
                    return connexion;
                catch (Exception e)
                    Console.WriteLine("Erreur: " + e);
                    return null;

    but I get this error:

    Échec de IErrorInfo.GetDescription avec E_FAIL(0x80004005).

    and return null

    any solution please?


    Wednesday, June 27, 2018 12:23 PM


All replies

  • User753101303 posted


    It seems OleDb can't even, retrieve an actual error message. The file does exists, is not password protected, is not blocked by an antivirus software ? I would perhaps try with a dead simple XLSX file to see what happens. If ok, I would add a macro and save to XLSM to see once again what happens with this simple file.

    I'm trying to understand if this is a problem on the web server side or if the problem could be caused by this particular XLSM file.

    Edit: try maybe to drop the final ; in case the connection string parser would expect then Something following this final separator ???

    Wednesday, June 27, 2018 1:54 PM
  • User36583972 posted

    Hi Kati Ais,

    Which section of the code causes this error? Please debug step by step.

    You can refer the following thread's solution: putting [] around the reserved word in the select statement.

    Error: IErrorInfo.GetDescription failed with E_FAIL(0x80004005):

    Please refer to PatriceSc's suggestion to share more details.

    Read and Write Excel Documents Using OLEDB:

    Best Regards,

    Yong Lu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 28, 2018 6:56 AM