Python Forum

Full Version: How to read and save specific outlook email into csv
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I receive the certain outlook email on daily basis which looks like a table with the subject : Creation Report - 30/04/2018(these dates change daily)

so far i tried this :

import win32com.client import os outlook=win32com.client.Dispatch("Outlook.Application").GetNameSpace("MAPI") inbox=outlook.GetDefaultFolder(6) #Inbox default index value is 6 message=inbox.Items message2=message.GetLast() subject=message2.Subject("XID Creation Report") body=message2.body date=message2.senton.date() sender=message2.Sender attachments=message2.Attachments print(subject) print(body) print(sender) print(attachments.count) print(date)
Since i dont have much experience in outlook scraping , how can i scrape this subject email from outlook and save it into excel

since body is case sensitive, i cant show it but it is a table.

can anyone please help?