Python Forum
How to read and save specific outlook email into csv
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to read and save specific outlook email into csv
#1
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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to save to multiple locations during save cubangt 1 546 Oct-23-2023, 10:16 PM
Last Post: deanhystad
  Search Outlook Inbox for set of values cubangt 1 1,064 Jun-28-2023, 09:29 PM
Last Post: cubangt
  Save image from outlook email cubangt 1 694 Jun-07-2023, 06:52 PM
Last Post: cubangt
  Pymodbus read and save to database stewietopg 3 1,854 Mar-02-2023, 09:32 AM
Last Post: stewietopg
  Read All Emails from Outlook and add the word counts to a DataFrame sanaman_2000 0 1,855 Sep-15-2022, 07:32 AM
Last Post: sanaman_2000
  How to save specific variable in for loop in to the database? ilknurg 1 1,145 Mar-09-2022, 10:32 PM
Last Post: cubangt
  Mark outlook emails as read using Python! shane88 2 6,547 Feb-24-2022, 11:19 PM
Last Post: Pedroski55
  Trying out the parsing/reading of emails from my outlook cubangt 0 6,154 Jan-12-2022, 08:59 PM
Last Post: cubangt
  Help Needed | Read Outlook email Recursively & download attachment Vinci141 1 4,075 Jan-07-2022, 07:38 PM
Last Post: cubangt
  [Solved] Trying to read specific lines from a file Laplace12 7 3,532 Jun-21-2021, 11:15 AM
Last Post: Laplace12

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020