Connecting to msaccess database from Python

Connect to msaccess file from Python and tweak it to emit desired format.

import pyodbc

conn = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=path where you stored the Access file\file name.accdb;')
cursor = conn.cursor()
cursor.execute('select * from table name')
   
for row in cursor.fetchall():
    print (row)

 

HTH

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *