I'm trying to download emails that users saved in download folder.
I take the path but when i try to open the email file i get errors.
The error: WinError 2
from datetime import datetime
import os
import pandas as pd
import win32com.client as win32
c = "c:\\Download"
outlook = win32.Dispatch("Outlook.Application")
for f in os.listdir(c):
os.starfile(f)
excel = f.Attachments
You are missing t on os.starfile
, should be startfile
and
os.startfile(f) # You are missing the path
so try
os.startfile(c + "\\" + f)