By Shailesh Sahu

2011-07-11 11:23:56 8 Comments

I'm trying to get data from an Excel file on a button click event. My connection string is:

 string connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\source\\SiteCore65\\Individual-Data.xls;Extended Properties=Excel 8.0;";

When I click on the button, I got the following error:

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.

I have no clue how to fix this. My operating system is Windows 7.


@josh 2019-05-11 23:27:21

Although many answers have been given, the problem I encountered was not yet mentioned.

  • My Scenario: 64-Bit Application, Win10-64, Office 2007 32-Bit installed.
  • Installation of the 32-Bit Installer AccessDatabaseEngine.exe as downloaded from MS reports success, but is NOT installed, as verified with the Powershell Script of one of the postings above here.

  • Installation of the 64-Bit installer AccessDatabaseEngine_X64.exe reported a shocking error message:

enter image description here

The very simple solution has been found here on an Autodesk site. Just add the parameter /passive to the commandline string, like this:

AccessDatabaseEngine_X64.exe /passive

Installation successful, the OleDb driver worked.

The Excel files I am processing with OleDb are of xlsx type, produced with EPPlus 4.5 and modified with Excel 2007.

@Sharif Lotfi 2019-03-21 05:08:28

do this 2 steps: 1. in this menu: project -> yourproject properties... -> Build : uncheck "prefer 32-Bit" 2. in connectionString : write cuotes before and after Extended properties, like this: Extended Properties='Excel 12.0 Xml;HDR=YES'

                var fileName = string.Format("{0}", openFileDialog1.FileName);
            //var connectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; data source={0}; Extended Properties=Excel 8.0;", fileName);
            var connectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0}; Extended Properties='Excel 12.0 Xml;HDR=YES'", fileName);
            var adapter = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", connectionString);
            var ds = new DataSet();

            adapter.Fill(ds, TableNmae);

            DataTable data = ds.Tables[TableNmae];
            dg1.DataSource = data;

@Variant 2011-07-11 11:28:15

Well, you need to install it. You're looking for:

@Sizons 2015-10-14 12:21:19

I downloaded these components and they did not work for me, I had to download the Microsoft Access Database Engine 2010 Redistributable from here: I'm sure that's because I'm using MS Office 2013. Thanks for pointing me in the right direction though.

@Chris 2015-12-15 14:27:55

I had to install the access database engine and the 2007 Office System Driver: Data Connectivity Components here to get it to work.

@eetawil 2016-01-25 14:21:13

My situation, everything was working fine, then all the sudden it started getting this error. SO what could have happened to cause this? No code changed.

@Rob Sedgwick 2016-06-19 12:02:00

In my case, I had to switch from "Any CPU" to x64 to match my architecture.

@silkfire 2016-12-15 22:56:11

Jack the Ripper refers to the solution provided in the answer itself, not the comments. Installing the 2007 Office System Driver: Data Connectivity Components resolved the issue immediately.

@AdorableVB 2017-05-08 05:51:27

with regards to @RobSedgwick 's comment, I did still use "Any CPU" but unchecked "prefer 32-bit" option. Works fine.

@Melbourne Developer 2017-11-09 21:50:29

Be aware that even on 64 bit machines, only the 32 bit driver works. I installed the 64 bit driver and it was still failing until I installed the 32 bit driver.

@Claude Martin 2018-02-01 08:43:19

Doesn't work for me: Office 2016, SSMS 17.4 and AccessDatabaseEngine. everything is 2016 or the latest release and 64bit. I tried the 32bit version of the ADD, but it can't be installed. It doesn't allow to mix 32bit and 64bit.

@Abhishek Poojary 2018-04-04 17:16:14

I was facing this error while importing excel file into SQL server. This solution fixed the issue.

@Omid-RH 2019-01-13 13:34:37

ِDownload And Install "Microsoft Access Database Engine 2016" from this link

@TsTeaTime 2019-02-26 01:41:33

This Link is now broken: I had to use

@Aaron Franke 2019-04-23 22:04:48

Where is the 64-bit version?

@Bernhard 2015-08-27 10:41:50

depending on the app(32/64bit) using the connection you could just install


  • all offices from 2007-2016 contain the provider "Microsoft.ACE.Oledb.12.0"
  • depending on your application architecture choose the appropriate runtime engine (32/64)
  • check your providers with the powershell-command from both 32 and 64bit shell:

  • and you will see which provider your system can use

the long story: the strings can be found with

eg. on a 64bit System with 32bit drivers installed

strings.exe -u -n 10 "c:\Program Files (x86)\Common Files\microsoft shared\OFFICE12\MSO.DLL" | findstr "ACE.O"
strings.exe -u -n 10 "c:\Program Files (x86)\Common Files\microsoft shared\OFFICE14\MSO.DLL" | findstr "ACE.O"
strings.exe -u -n 10 "c:\Program Files (x86)\Common Files\microsoft shared\OFFICE15\MSO.DLL" | findstr "ACE.O"

even in the upcoming office 2016

c:\Program Files\Microsoft Office\root\VFS\ProgramFilesCommonX64\Microsoft Shared\OFFICE16\MSO.DLL
c:\Program Files\Microsoft Office\root\VFS\ProgramFilesCommonX86\Microsoft Shared\OFFICE16\MSO.DLL

you will find the strings

  • Microsoft.ACE.OLEDB

  • Microsoft.ACE.Oledb.12.0

the Office 2013 comes also with csi.dll

c:\Program Files (x86)\Common Files\microsoft shared\OFFICE15\Csi.dll
c:\Program Files\Common Files\Microsoft Shared\OFFICE15\Csi.dll

which contains the "Microsoft.ACE.OLEDB.15.0"

and Office 2016

c:\Program Files\Microsoft Office\root\VFS\ProgramFilesCommonX64\Microsoft Shared\OFFICE16\Csi.dll
c:\Program Files\Microsoft Office\root\VFS\ProgramFilesCommonX86\Microsoft Shared\OFFICE16\Csi.dll

which has the "Microsoft.ACE.OLEDB.16.0" version

@subsci 2017-07-25 04:36:47

I got this error in VS2015 using Nuget LinqToExcel. Turns out, because I had the x64 ACE installed, I had to explicitly build for x64 (Configuration Manager), instead of targeting Any CPU.

@SushiGuy 2018-03-05 19:03:59

Powershell showed "Microsoft.ACE.Oledb.12.0" was installed already. However installing the Access 2007 package (aka 2007 Office System Driver: Data Connectivity Components) got me up and going. Already on my system: Office 2016 Ent, Visual Studio 2017 Ent

@Rob Bowman 2018-08-08 14:53:59

The PowerShell script that informs which version is installed is genius! Thank you @Bernhard

@Bernhard 2018-09-25 13:38:25

bit offtopic but this simple powershell is for your ODBC drivers : Get-OdbcDriver | select Name,Platform

@Md Shahriar 2018-07-20 18:22:35

I faced this same problem. Go to the Solution Properties and change Any CPU to x86, I think it will do the job.

@Mohammad Fathi MiMFa 2018-06-27 10:05:50

This worked for me right now.

  1. Visit this page then download that appropriated package for your computer (AccessDatabaseEngine.exe or AccessDatabaseEngine_X64.exe)
  2. Install that.
  3. Enjoye... Your codes is work now...

But for your application package you can use of any the following solutions:

  1. Go in "C:\Program Files (x86)\Common Files\microsoft shared" or "C:\Program Files\Common Files\Microsoft Shared" and put the "OFFICE14" directory in the same location of your package file.


  1. Attach two projects (in item1) in your installation package.

@Shubham Tiwari 2017-12-20 07:55:19

First verify which version of microsoft.ace.oledb.12.0 is installed in your system.

Check in below path C:\Program Files\Common Files\Microsoft Shared\OFFICE14\ACEOLEDB.DLL --64 bit is installed

Check in below path C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE14\ACEOLEDB.DLL --x86 bit is installed

If (x86) is installed then using configuration manager change solution platform to x86, for x64 change to x64.

If not available then install using below link

@Humbert 2017-11-02 00:07:29

The way I solved it on different computers:

I have a Windows 7 32bit machine with Visual Studio 2012 which did not have the Access Database because I do not have the Office 2010. I copied the same source I had in my Windows 7 64bit machine.

So, I installed the AccessDatabaseEngine into this Windows 7 32 bit machine after downloading it per above suggestions from others here and everything worked fine.

I still had the problem on my Windows 7 64 bit machine which already has Office 2010 that already includes Access 2010. The way I solved on this computer was by going into the PROJECT, selected Properties, and at Platform target had Any CPU I checked Prefer 32-bit. Recompiled/Build and the Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine message was gone.

@Humbert 2017-11-02 00:11:44

Apparently, the Office I bought installs by default as for 32bit unless you buy Office for 64 bit machines, I am not an expert on this but that is my guess - I will find out more if this is true. If I am going to use it with 64 bit full potential then I have to download the AccessDatabaseEngine 64bit version as suggested by others above. For now since what I had is the 32 bit engine I had to make my application prefer 32bit CPU.

@Chagbert 2017-09-12 08:36:06

I received this error when importing data from an Excel file into MS-SQL. The provider was already installed (64-bit) and this surprised me why it didn't work. So all I did was locate the Import/Export application used here i.e. the .EXE. And I found it at

C:\Program Files\Microsoft SQL Server\130\DTS\Binn\DTSWizard.exe

I then ran the .exe directly to perform the data import. And it worked!

@Prince Antony G 2017-05-09 07:40:01

If you get this error when trying to use ACE from an ASP.NET application, the most likely cause is that you have installed either one of the 32-bit versions. By default, IIS on a 64-bit operating system will run applications in a 64-bit worker process. 64-bit processes cannot load 32-bit DLLs. When a call is made to the ACE provider, the 64 bit process will attempt to locate a 64-bit DLL. If it doesn't exist, you get the error message that brought you here.

In this case you have two options. First, you can install the 2010 64-bit version. If you have the 2007 32-bit version installed, you can simply install the 2010 64-bit version alongside it. If you have the 32-bit version of 2010 installed, you need to uninstall it and download and install the 64-bit 2010 version instead. You cannot have both the 32- and 64-bit versions of the 2010 provider installed at the same time. If you are performing the installation on your development machine, you may also be constrained by the bit-ness of any existing Office installations.

The second option is to change the application pool in IIS to enable 32-bit applications. If you are using the full version of IIS, you can use the management tool to do this (Control Panel » Administrative Tools » Internet Information Services (IIS) Manager).

For more understanding please refer below link

@Taran 2017-04-12 06:54:20

I had this issue when attempting to import data from an excel file (xlsx) into a SQL Server DB using SSMS 2014.

The 2007 Office System Driver: Data Connectivity Components install did the trick for me.

@tgolisch 2019-05-16 15:27:53

...and if that doesn't work, try picking a different "Excel Version" from the dropdown list of the "choose data source" screen.

@Biki 2017-04-07 10:31:56

Just download & install the following Access DB engine (X86 or X64: as per your machine configuration) and see the magic :)

@u8it 2015-05-19 16:08:50

1.) Verify your connection string with

2.) Make sure you have the correct database engine installed. These were the two database engines that helped me.

Microsoft Access Database Engine 2010 Redistributable

2007 Office System Driver: Data Connectivity Components

3.) There could be an issue with your build target platform being "Any CPU", it may need to be "X86" (Properties, Build, Platform Target).

@Merav Kochavi 2015-10-11 05:39:00

You can run it under ANY platform, NOT ONLY 'x86', but as 'Any CPU' as 'x64' as well. See full answer below:

@u8it 2017-01-27 18:55:11

Ok, well I don't think that was the case for me... so it's still worth mentioning that someone's build target platform may be part of the issue.

@mohit busa 2016-02-19 07:35:06

You need to change the Solution Platform from "Any CPU" to "x86" or "x64" based on the bitness of office installation.

The steps are given below:

  1. Right click on the Solution File in Solution Explorer: enter image description here

    1. Click on the Configuration Manager.
    2. Click on the Active Platform Drop down, if x86 is already there then select that, else click on New. enter image description here

    3. Select x86 or x64 from the new platform dropdown: enter image description here

Compile and run your application.

@Albert Zakhia 2016-07-13 05:23:23

If you are debugging a web project, just make sure IIS Express is running either in 32 or 64 bits depending on your project settings.


Tools > Options > Projects and Solutions > Web Projects

and from there check (or uncheck) the 'Use 64 bit version of IIS Express...'

@Hernaldo Gonzalez 2016-11-16 18:41:56

Wow a lot of hours tryng other solutions, only your fix it! thanks

@Sagar 2016-04-18 18:39:14

I had Microsoft Access Database Engine 2010 Redistributable already installed on my machine but was still receiving the Microsoft ACE OLEDB Provider error.

Then I recalled that I had upgraded to Office 2016 recently, so, may be I should try reinstalling Microsoft Access Database Engine 2010 Redistributable. And that fixed the problem on my machine.

So, if you have upgraded to different version of MS Office or even repaired/reinstalled your MS Office then try reinstalling Microsoft Access Database Engine 2010 Redistributable before wasting time with finding other fixes. Good luck!

@Aximili 2013-04-13 06:25:41

If you're using 64-bit but still having problem even after installing AccessDatabaseEngine, see this post, it solved the problem for me.

i.e. You need to install this AccessDatabaseEngine

@Maulik Modi 2016-01-05 10:32:51

  • I've been facing the same issue for days. I did installed OLEDB drivers for 64 bit, tried out 32 bit also which are available at microsoft website.
  • I tried to reinstall office 64bit version also somehow it didn't work. Tried Allowing 32bit application in IIS pool true.
  • Tried Changing project environment to X86, AnyMachine, Mixed. And almost tried all the patch that i could find on internet. But all solution disappointed me.
  • Although i finally came to know that the provider which we were downloading was latest and was not working with it either.
  • I uninstalled it and installed oledb drivers 14.0.7015.1000 .I dont have the link for it as i got it from company resources , you might have to google it but it works. I came on this DOWNLOAD LINK of microsoft and it worked too... however it is version 14.0.6119.5000 but it worked.

@Ken Johnson 2015-11-30 18:51:00

I was able to fix this by following the steps in this article:

The key point for me was this:

When debugging with IIS,

by default, Visual Studio uses the 32-bit version. You can change this from within Visual Studio by going to Tools » Options » Projects And Solutions » Web Projects » General, and choosing

"Use the 64 bit version of IIS Express for websites and projects"

After checking that option, then setting the platform target of my project back to "Any CPU" (i had set it to x86 somewhere in the troubleshooting process), i was able to overcome the error.

@illinoistim 2016-10-03 19:11:08

Thank you, most other answers are for going down to 32 bit, but this helps you move forward to 64 bit.

@NetStarter 2015-10-23 06:48:05

I had the same issue but in this case microsoft-ace-oledb-12-0-provider was already installed on my machine and working fine for other application developed.

The difference between those application and the one with I had the problem was the Old Applications were running on "Local IIS" whereas the one with error was on "IIS Express(running from Visual Studio"). So what I did was-

  1. Right Click on Project Name.
  2. Go to Properties
  3. Go to Web Tab on the right.
  4. Under Servers select Local IIS and click on Create Virtual Directory button.
  5. Run the application again and it worked.

@Merav Kochavi 2015-09-24 11:29:37

The first thing you need to check is your build configuration of your application.

  • If you have built your project under x86 platform, then in order to resolve you issue you should install the following packages on your machine:

    1. In order to use the 'Microsoft.ACE.OLEDB.12.0' provider you must install the Microsoft Access Database Engine 2010 Redistributable first, this installation is available at: .

      After the installation has complete, try running you application, if this solves the issue great, if not, continue to step 2.

    2. This next step is an unexplained workaround, which works for Office 2010, even though it is the Data Connectivity Components of Office 2007. I am not quite sure why this works, but it does and this has been proven to work in almost all cases. You need to install the 2007 Office System Driver: Data Connectivity Components, this installation is available at: .

      After this installation is complete, try running your application, this should resolve the issue.

  • If you are trying to run an application built under x64 or AnyCPU platform, I would recommend first validating that it runs as expected under the x86 platform. In the event that it does not run under that x86 platform, perform the steps in the first part and validate that it runs as expected.

    I did read that the MS Access drivers including the OLEDB Database driver works only under the x86 platform and is incompatible under the x64 or AnyCPU platform. But this appears to be untrue. I validated my application was running when building x86, then I installed the Access Database Engine using the passive flag.

    1. First download the file locally You can download the installation here:
    2. Installing using the command prompt with the '/passive' flag. In the command prompt run the following command: 'AccessDatabaseEngine_x64.exe /passive'

    After these 2 steps I managed to run my application after building in x64 or AnyCPU build configuration. This appeared to solve my issue.

Note: The order of the steps seems to make a difference, so please follow accordingly.

@Freddy 2016-04-06 17:31:48

I had the problem that I was switching from a 32bit application to 64bit and it did not run anymore. The second part of your instructions works perfectly! The /passive flag allows installation even with a 32bit Microsoft Office.

@Jeremy Thompson 2017-04-03 03:24:21

Tip: Extract the AccessDatabaseEngine_x64.exe to a folder to get the AceRedist.msi and a files. Open cmd prompt in Admin mode and execute the AceRedist.msi /passive.

@Biki 2017-04-07 10:27:00

Thanks a lot. The first option worked for me. I remember how much hassle I was facing to uninstall 32 bit Office & only after installing 64 bit office this issue was getting fixed earlier. But this 64 bit office component done the magic instead.

@SENA 2019-01-16 03:56:50

Because of 2 point i have fixed. Thank you very much. I need to install this one .

@Shaul Behr 2015-09-09 10:56:48

I installed the MS drivers and it still didn't work for me. Then I found this blog post that solved the issue. Read it there, else use these two images (linked from that post) as the TLDR sumamary:

enter image description here

enter image description here

@myroslav 2017-08-21 21:21:40

This was the only thing that worked for me as well.

@Lee 2017-09-29 08:30:11

Was about to post this as my contribution. This was my problem. I'd change this IIS setting yesterday since one project in my solution was x86 compiled, so I'm assuming it will class the entire program as 32-bit.

@MarceloBarbosa 2017-10-23 19:29:30

My server is running @64bits but the MS Office Components installed is 32bits. This solved my issue. Thank you.

@David Rogers 2017-12-13 16:21:40

What a incredible difficult thing to get working :(, I wonder if you could script this in powershell and just integrate it into some sort of automated server setup script?

@Shaul Behr 2017-12-13 16:31:03

@DavidRogers probably, but I'm not an expert in PS, so don't look to me for that! ;-)

@David Rogers 2017-12-13 16:48:13

@ShaulBehr Hopefully this provides insight to others, The specific command I used was(In a elevated powershell/cmd window): "C:\Windows\System32\inetsrv\./appcmd set apppool / /enable32BitAppOnWin64:true"

@raj 2018-04-07 08:04:50

@ShaulBehr, Thank you. You saved me a lot of time.

@sosha 2015-08-30 05:15:41

Remember to install AccessDatabaseEngine on server for web application.

@user4237179 2015-04-12 18:11:00

It depends with the office you have installed, if you have x64 bit office then you must compile the application as a x64 to allow it to run, so if you want it to run on x36 then you must install office x86 to accept, i tried all the solutions above but none worked until when i realised i had office x64bit and so i built the application as x64 and worked

@AStopher 2015-08-10 07:41:00

Incorrect, I have Office installed and had to install the DB Connector regardless.

@sam byte 2015-09-18 23:53:36

This solves my problem when NONE of the above works for me!

@TechSpud 2014-01-30 11:48:28

For all those still affected by this.

I've been getting the error...

OLEDB error "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine." described by the OP, Shailesh Sahu.

I have 64bit Windows 7.

My problem is within PowerShell scripts, but is using a connection string, similar to the OP's post, so hopefully my findings can be applied to C#, PowerShell and any other language relying on the "Microsoft.ACE.OLEDB" driver.

I followed instructions on this MS forum thread:

I first tried installing the 64bit version, then installing the 32bit version of the AccessDatabaseEngine.exe from this page

But still no joy.

I then ran the code below in PowerShell (from SQL Panda's site


...which gave me this result (I've removed other data sources for brevity)...

SOURCES_NAME              SOURCES_DESCRIPTION                                                                       
------------              -------------------                                                                       
Microsoft.ACE.OLEDB.15.0  Microsoft Office 15.0 Access Database Engine OLE DB Provider

As you can see, I have Microsoft.ACE.OLEDB.15.0 (fifteen) not Microsoft.ACE.OLEDB.12.0 (twelve)

So, I amended my connection string to 15 and it worked.

So, a quick PowerShell snippet to demonstrate how to soft-code the version...

$AceVersion = ((New-Object System.Data.OleDb.OleDbEnumerator).GetElements() | Where-Object { $_.SOURCES_NAME -like "Microsoft.ACE.OLEDB*" } | Sort-Object SOURCES_NAME -Descending | Select-Object -First 1 SOURCES_NAME).SOURCES_NAME

$connString = "Provider=$AceVersion;Data Source=`"$filepath`";Extended Properties=`"Excel 12.0 Xml;HDR=NO`";"

amended to pick the latest ACE version, if more than one

Hopefully, anyone finding this can now check to see what OLEDB version is installed and use the appropriate version number.

@doganak 2014-12-02 12:33:17

Hi, I'm trying to read Excel sheets with PowerShell. Excel files stored in a SharePoint document library and there is no Excel installation on the server. I have windows server 2008 R2. I installed Office System Driver: Data Connectivity Components however when I run your query can not see Microsoft.ACE.OLEDB. Do you have an idea about that? and any suggestion? Thanks in advance.

@doganak 2014-12-02 15:38:21

I found the answer. I had asked to our system administrator to install MS Access Database Engine. He had installed x86 version. When I run the query in PowerShell x86 again I saw ACE.OLEDB.

@Doppelganger 2016-04-12 16:10:02

Awesome PowerShell code. I had the 32-bit version (which didn't show up in the PowerShell list), which prevented me from installing the 64-bit one. Once I removed the 32-bit version, I was able to install the 64-bit version without the "you already have 32-bit Office components..." message. The 64-bit version did show up in the PowerShell list, and my app started working.

@Diego Castro 2015-03-18 19:35:42

also can try these steps

In the SQL Server, 1.Open one data base 2.Clic in the option 'Server Obtect' 3.Clic in 'Linked Servers' 4.Clic in 'Providers' 5.Clic Rigth in 'Microsoft.ACE.OLEDB.12.0' 6.Uncheck all the options and close

@Rahul Techie 2015-02-13 09:11:48

I have similar issue when we are reading Excel file.

History of the problem:

We recently migrated our application from 32-bit to 64-bit because of the memory requirement. For that we migrated our windows 7 from 32-bit to 64-bit. But still we installed 32-bit office on our machines.

because, of this we had this issue while importing Excel data into application.


I downloaded 64-bit version of the and installed with argument as,

AccessDatabaseEngine_x64.exe /passive

Without any code change my issue get resolved.


On 64-bit OS and 64-bit office, my functionality was working fine without this fix. This fix is only required while our application is 64-bit running on 64-bit OS which is having 32-bit office installed on it.

@Rahul Techie 2015-05-27 09:39:14

But, Microsoft is against this solution. Few of my clients observe distortion in other Office programs because of this fix.

@Kavit Trivedi 2013-04-30 06:59:21

//Read .xls file

string strConnection = "";<br/>

string FileName = Server.MapPath("Student.xls");

strConnection = @"Provider=Microsoft.JET.OLEDB.4.0;Data Source=" + FileName + ";Extended Properties='Excel 8.0; HDR=Yes;IMEX=1;'";<br/>

    OleDbConnection conn1 = new OleDbConnection(strConnection);
    DataTable dt = new DataTable();
    dt = conn1.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new Object[] { null, null, null, "TABLE" });

    Object sheetName = dt.Rows[0]["TABLE_NAME"];
    OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM [" + sheetName.ToString() + "]", conn1);
    da.TableMappings.Add("Table", "0");

    for (int i = 0; i < dt.Rows.Count; i++)
        string ID = dt.Rows[i][0].ToString();
        string Name = dt.Rows[i][1].ToString();
        string City = dt.Rows[i][2].ToString();
        string Marks = dt.Rows[i][3].ToString();
//To Read xlsx file use following code
string strConnection = "";  <br/>
string FileName = Server.MapPath("Student.xlsx"); <br/>
strConnection = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + FileName + ";Extended Properties='Excel 12.0 Xml;HDR={1};IMEX=1;'";<br/>

    OleDbConnection conn1 = new OleDbConnection(strConnection);

    DataTable dt = new DataTable();
    dt = conn1.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new Object[] { null, null, null, "TABLE" });

    Object sheetName = dt.Rows[0]["TABLE_NAME"];
    OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM [" + sheetName.ToString() + "]", conn1);
    da.TableMappings.Add("Table", "0");
    //int idx=0;
    //int j=0;
    for (int i = 0; i < dt.Rows.Count; i++)
        string ID = dt.Rows[i][0].ToString();
        string Name = dt.Rows[i][1].ToString();
        string City = dt.Rows[i][2].ToString();
        string Marks = dt.Rows[i][3].ToString();


// Now install AccessDatabaseEngine.exe from "" link

It will work 100%

@Ads 2014-08-07 01:48:59

I followed the instructions set out by others; installing this patch, installing that patch as well as the Microsoft Access Database Engine 2010.

My issue was that I'm using the same library (linq2sql) in 2 sites on my machine; 1 works and 1 doesn't.

Eventually I found that I had to "enable 32 bit applications" in the advanced settings of the apppool for my non-working site.

Everything works fine now.

@Sevron Ghee 2014-06-26 14:20:03


The solution for me as you suggested for the "Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine" error is to change the Active Solution Platform from "Any CPU" to "x86".

When I performed those steps, rebuilt the solution, grabbed the EXE and placed in on the network, everything worked smoothly on the Windows 7 64 bit machine.

@Mark Kram 2015-01-01 16:06:35

This fixed it for me thanks +1

@Merav Kochavi 2015-10-11 05:27:47

You can run it under any platform, NOT ONLY x86, but as Any CPU as well. See my answer below:

Related Questions

Sponsored Content

3 Answered Questions

[SOLVED] Microsoft.ace.oledb.12.0 not registered on the local machine

6 Answered Questions

[SOLVED] 'Microsoft.ACE.OLEDB.16.0' provider is not registered on the local machine. (System.Data)

20 Answered Questions

0 Answered Questions

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. in win10

  • 2016-10-29 05:21:23
  • Alien 1377
  • 18 View
  • 1 Score
  • 0 Answer
  • Tags:   c#

2 Answered Questions

4 Answered Questions

1 Answered Questions

"The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine"

  • 2014-04-16 11:42:56
  • Saurabh Soni
  • 301 View
  • -2 Score
  • 1 Answer
  • Tags:   c#

0 Answered Questions

'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine giving exception on client

2 Answered Questions

[SOLVED] Opening an Excel spread sheet in .NET on a x64 system

  • 2009-06-30 15:15:29
  • Bob The Janitor
  • 1212 View
  • 3 Score
  • 2 Answer
  • Tags:   .net excel 64-bit

Sponsored Content