Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect to excel 2007 file using ADOConnection in Delphi7

I want to connect to an excel 2007 file(.xlsx) using delphi 7, so I used a AdoConnection and set its connectionstring property as:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test\qm\Results-summary.xlsx;Extended Properties="Excel 12.0;IMEX=1";Persist Security Info=False

But when I active the AdoConnection i get this error:

Could not find installable ISAM.

Where is the problem?

like image 631
Masoud Avatar asked Sep 23 '13 05:09

Masoud


1 Answers

I found the solution. my mistake was using Microsoft.Jet.OLEDB.4.0 driver for excel 2007 file. I changed it to Microsoft.ACE.OLEDB.12.0 driver and set the extended property to Extended Properties="Excel 12.0 Xml;HDR=yes", now my connection string is:

Provider=Microsoft.ACE.OLEDB.12.0;User ID=Admin;Data Source=C:\test\qm\Results-summary.xlsx;Mode=Share Deny None;Extended Properties="Excel 12.0 Xml;HDR=yes";Jet OLEDB:System database="";Jet OLEDB:Registry Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=37;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False;Jet OLEDB:Support Complex Data=False

and it works:)

like image 132
Masoud Avatar answered Oct 12 '22 15:10

Masoud