Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. df = pd.read_excel(r'path')
  2. df = pd.DataFrame(df)
  3. df = df[['Short Name','File Name']]
  4.  
  5. print(df)
  6.  
  7. outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
  8.  
  9. inbox = outlook.GetDefaultFolder(6)
  10. subfolder = inbox.Folders(2)
  11.  
  12. messages = subfolder.Items
  13.  
  14. for message in messages:
  15. attachments = message.attachments
  16. for attachment in attachments:
  17. attachment.SaveAsFile(r'path' + '\'+'test' + str(attachment))
  18. print(format(attachment))
  19.  
  20. So far I have this code that downloads the files to a designated folder and prints the first word of the subject. Please link any documentation/ learning material as everything is very new for me.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement