Automation Excel from Python

You’ll need the Python Win32 extensions – http://sourceforge.net/projects/pywin32/

(now migrated to GitHub: https://github.com/mhammond/pywin32)

Then you can use COM.

from win32com.client import Dispatch
excel = Dispatch('Excel.Application')
wb = excel.Workbooks.Open(r'c:\path\to\file.xlsx')
ws = wb.Sheets('My Sheet')
# do other stuff, just like VBA
wb.Close()
excel.Quit()

You can put your script on Windows Task Scheduler to run for the times you need.

Leave a Comment