none
Reading .xlsx files from OLEDB Provider RRS feed

  • Question

  • Hi
    I am working in C# 2.0.
    I have to read data from the .xlsx files (MS Excel 2007).

    For previoue versions of excel files we were using

    Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" file location"; Extended Properties=Excel 8.0;IMEX=1;HDR=yes

    Anyone please let me know, what changes we need to do in the connection string for reading values from the Excel 2007(.xlsx) files
    Its quite urgent.


    brgds

    Friday, September 21, 2007 11:35 AM

Answers

  • Hi,

     

    This is not the correct forum for that question, but anyway, the connection string should look like this:

     

    Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsx;Extended Properties="Excel 12.0;HDR=YES";

     

    For more information, you can take a look at www.connectionstrings.com

     

    Regards,

    Pablo.

    Friday, September 21, 2007 1:54 PM

All replies

  • Hi,

     

    This is not the correct forum for that question, but anyway, the connection string should look like this:

     

    Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsx;Extended Properties="Excel 12.0;HDR=YES";

     

    For more information, you can take a look at www.connectionstrings.com

     

    Regards,

    Pablo.

    Friday, September 21, 2007 1:54 PM
  • THESE INSTRUCTIONS ARE WRONG, as is connectionstrings.com.

    Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsx;Extended Properties="Excel 12.0;HDR=YES";

    Excel 12.0 ONLY WORKS FOR xlsb files, the correct entry, which you can verify in the registry(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Access Connectivity Engine\ISAM Formats), is

    Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsx;Extended Properties="Excel 12.0 Xml;HDR=YES";
    Wednesday, March 12, 2008 10:28 AM
  • The former worked for me.

    Thursday, July 10, 2008 5:30 PM
  • I have got this answer when running this query

    SELECT *

    FROM

    OPENDATASOURCE

    (

    'Microsoft.ACE.OLEDB.12.0','Data Source=C:\fname.xlsx; Extended Properties="Excel 12.0;IMEX=1;HDR="YES"')...[fname$];

     


    Msg 7302, Level 16, State 1, Line 1

    Cannot create an instance of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".

     



    Please help me.


    Manish


    manish
    Thursday, July 9, 2009 12:56 PM
  • Is this component (or Office 2007) installed on your system?

    http://www.microsoft.com/downloads/details.aspx?familyid=7554F536-8C28-4598-9B72-EF94E038C891&displaylang=en


    Paul ~~~~ Microsoft MVP (Visual Basic)
    • Proposed as answer by learnbee Wednesday, February 24, 2010 9:25 PM
    Thursday, July 9, 2009 3:12 PM
  • I had the similar problem: The following worked for me.

    "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\\Test.xlsx;Extended Properties=\"Excel 12.0;HDR=YES;\""

    Hope this helps...
    • Proposed as answer by LearnerSql Friday, February 26, 2010 9:06 AM
    Wednesday, February 24, 2010 9:27 PM
  • I've had similar problem.

    The error may not be in the connection string, but on a 64 bit OS incompatibility.

    Please verify:

    Visual Studio> Right click on the name of your solution> Click "Properties"> click the "Build"

    Make sure the "Platform Target" is X86

    In "Platform" is X86

    Changing these settings in my case went to work.


    Tuesday, October 9, 2012 3:42 PM