1

I have data in the form of nested list. i am converting this data into dataframe. Now i want to convert this dataframe into excel (without storing on local system) and attach/dynamically send mail with this excel file as a attachment

i can download the excel file on local system and then attach to mail and send this mail
but i dont want to store locally it is directly generate and attach to mail and send

data = [['1', 'Ram', 'PL', 'NA', '04/24/19'];['2', 'Dhana', 'PL', 'NA', '04/24/19'],['3', 'Nares', 'A', 'NA', '04/24/19']]

df = pd.DataFrame(data, columns=['ad_id','ename','shift','status','date'])

output

    ad_id   ename   shift   status  date
0   458435  Ram     PL      NA  04/24/19
1   471611  Dhana   PL      NA  04/24/19
2   476934  Naresh  A       NA  04/24/19

I expect it directly generate the excel file and attach to mail and send

  • 1
    You really need to present some code you've written to try and solve the problem – HenryM Apr 24 '19 at 07:44
  • From what I understand you'd have to make a custom `ExcelWriter` (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_excel.html) that writes the binary output in memory, and send this as an attachment in your mail. https://stackoverflow.com/questions/27646065/attaching-an-image-or-object-from-memory-to-an-email-in-python – Adonis Apr 24 '19 at 09:37

0 Answers0