title: how to copy the contents of an excel sheet and paste it in the body of an email.(Not as an attachment) using Python
body: <p>I'm writing a python script to send email. Right now it is sending an excel file as an attachment, but instead I want to send the email with the body having the contents of the excel file. Like copying the contents of the excel file with color, formatting etc. and then pasting it in the body of an email.</p>
  
  <pre class="lang-py prettyprint-override"><code>import win32com.client
  from openpyxl import load_workbook 
  import pandas as pd 
  o = win32com.client.Dispatch("Outlook.Application") 
  Msg = o.CreateItem(0)
  
  Msg.To = "abc@gmail.com"
  
  Msg.CC = "xyz@gmail.com" 
  Msg.BodyFormat = 2 
  Msg.HTMLBody = """
  &lt;html&gt;
  &lt;body&gt;
     &lt;p&gt;Hello All,&lt;br&gt;
         &lt;br&gt;
         Test HTML mail body from Python
      &lt;/p&gt;
    &lt;/body&gt;
  &lt;/html&gt;"""
  Msg.Subject = "Automation Test" 
  attachment1 = "D:\Demo.xlsx" 
  Msg.Attachments.Add(attachment1) 
  Msg.Send()
  </code></pre>
  
  <p>This code is working fine but I could not figure out how to add the contents of the excel directly in to the body of an email.</p>