How can I access Microsoft Access databases in Python? With SQL?
I\'d prefere a solution that works with Linux, but I could also settle for Windows.
I only r
To read an Access database as a pandas dataframe (Windows).
This is a very quick and easy solution that I have used successfully for smaller databases.
You can read an Access database by making a permanent link to Excel and saving that file (it takes a couple of clicks), link here:
https://support.office.com/en-gb/article/Connect-an-Access-database-to-your-workbook-a3d6500c-4bec-40ce-8cdf-fb4edb723525
You can then simply read that Excel file as a pandas dataframe.
So, for example, save the linked Excel file as 'link_to_master.xlsx' in location \FileStore\subfolder1\subfolder.
Run the following in python:
import pandas as pd
import os
os.chdir('\\\\FileStore\\subfolder1\\subfolder') #sets the folder location
df = pd.read_excel('link_to_master.xlsx') # reads the Excel file
df
Consider frequency of the link refresh if you are re-visiting your python script. i.e. The link between Excel and Access is static.