Bobspadger / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

not able to connect excel 2007 files *.xlxs #166

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.>>>import pyodbc
2.>>>conn=pyodbc.connect('DRIVER={Microsoft Excel Driver 
(*.xlsx)};DBQ=D:\\test.xlsx',autocommit=True)
3.

What is the expected output? What do you see instead?

i got the error:
Traceback (most recent call last):
  File "<pyshell#28>", line 1, in <module>
    conn=pyodbc.connect('DRIVER={Microsoft Excel Driver (*.xlsx)};DBQ=D:\\test.xlsx',autocommit=True)
Error: ('IM002', '[IM002] [Microsoft][ODBC 
\xc7\xfd\xb6\xaf\xb3\xcc\xd0\xf2\xb9\xdc\xc0\xed\xc6\xf7] 
\xce\xb4\xb7\xa2\xcf\xd6\xca\xfd\xbe\xdd\xd4\xb4\xc3\xfb\xb3\xc6\xb2\xa2\xc7\xd2
\xce\xb4\xd6\xb8\xb6\xa8\xc4\xac\xc8\xcf\xc7\xfd\xb6\xaf\xb3\xcc\xd0\xf2 (0) 
(SQLDriverConnectW)')

What version of the product are you using? On what operating system?

it works well for *.xls files but why can't i connect *.xlsx?

Please provide any additional information below.

Original issue reported on code.google.com by chiwha...@gmail.com on 22 Mar 2011 at 6:50

GoogleCodeExporter commented 9 years ago
I cannot find an ODBC driver named "Microsoft Excel Driver (*.xlsx)", not even 
with a Google search.  Do you really have a driver by that name installed, or 
are you guessing the name?  Installed drivers are shown on the "Driver" tab of 
the ODBC Data Source administrator, accessed via:
- Start menu -> Run -> odbcad32.exe -> OK
- for 32-bit drivers on 64-bit OS: Start menu -> Run -> 
c:\windows\syswow64\odbcad32.exe -> OK

With Office 2010 installed, I can see the following drivers:
{Microsoft Excel Driver (*.xls)}
{Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)}

Original comment by lukedell...@gmail.com on 22 Mar 2011 at 12:12

GoogleCodeExporter commented 9 years ago
Thank you!
You are right,  I should use  {Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, 
*.xlsb)} to connect .xlsx files

While previously i guess the name  {Microsoft Excel Driver (*.xls, *.xlsx)}, or 
{Microsoft Excel Driver (*.xlsx)}, they are all incorrect.

Original comment by chiwha...@gmail.com on 22 Mar 2011 at 1:30

GoogleCodeExporter commented 9 years ago

Original comment by mkleehammer on 20 May 2011 at 7:46