title: Using python to extract an excel table and pasting as an image on an outlook email and sending it out
body: <p>I need to write a code to tell Python to look into an excel sheet, extract a table and paste it as an image on an email. Thus far, I have managed to tell Python to write web content onto that excel file from a website and even send out an email. The gap is really lies in the step described in the first sentence above. The whole idea of this project is really not needing to open the excel file at all and running everything via Python.</p>
  
  <p>Been spending quite abit of time on this but the best result so far is only one where Python can print cell data from excel but no the entire table as an image.</p>
  
  <p>Really appreciate some help here. Thank you and cheers.</p>
  
  <p>Code attached: </p>
  
  <pre><code>import requests
  response = requests.get("")
  txt=response.text
  lines = txt.split('\n') 
  print(lines[25])
  
  from openpyxl import load_workbook
  
  wb = load_workbook(filename = 'abc.xlsm', read_only=False, keep_vba=True)
  ws1 = wb['Sheet1']
  ws1['A2'].value = (lines[25])
  
  
  wb.save('abc.xlsm')
  
  # Up to this point I have managed to get Python to extract web content and write into an existing excel file.
  
  import win32com.client
  olMailItem = 0x0
  obj = win32com.client.Dispatch("Outlook.Application")
  newMail = obj.CreateItem(olMailItem)
  newMail.Subject = "My Subject"
  newMail.Body = "My Body"
  newMail.To  = "..."
  newMail.Send()
  
  
  #This sends out the email. This tries to get Python to print out the entire sheet but it comes out quite jumbled:
  
  import xlrd
  book = xlrd.open_workbook('C:/Users/adriel.cheng/Desktop/Inspection Sales_v8.xlsm')
  print (book.nsheets)
  
  print (book.sheet_names())
  
  #An alternative approac but it also comes out jumbled:
  
  import pandas as pd
  xl = pd.ExcelFile('C:/Users/adriel.cheng/Desktop/Inspection Sales_v8.xlsm')
  xl.sheet_names
  
  
  df = xl.parse("Inspections sheet")
  
  print (df)
  </code></pre>