Unable to install Microsoft.ACE.OLEDB.12.0 on Azure VM (W10)

Viewed 112

I am trying to get some old code to work, and it requires the use of Microsoft.ACE.OLEDB.12.0 to read an excel file.

Yet, when I run below piece of code, I get the infamous 'THE 'MICROSOFT.ACE.OLEDB.12.0' PROVIDER IS NOT REGISTERED ON THE LOCAL MACHINE' error.

Powershell code:

$connection_str = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=$($_.FullName);Extended Properties=`"Excel 8.0;HDR=NO`"";

$conn = New-Object System.Data.OleDb.OleDbConnection($connection_str)

$conn.open()

When I install MICROSOFT.ACE.OLEDB.12.0, it tells me that it has been installed successfully. However, it continues to fail. Anyone who has had the same issue?

Edit: When I run below code, it seems that Microsoft.ACE.OLEDB.12.0 never gets added as a source.

foreach ($provider in [System.Data.OleDb.OleDbEnumerator]::GetRootEnumerator()){  for ($i = 0; $i -lt $provider.FieldCount; $i++){
        Write-Host $provider.GetName($i), $provider.GetValue($i) |Format-List
    }
Write-Host
 
}
0 Answers
Related