title: Sending email with Sendgrid using data from a csv
body: <p>I am trying to send out an email using Sendgrid and adding data from a csv into the body of the email. I can do this process with smtplib but now I need to do it using sendgrid.</p>
  
  <pre><code>import os
  import pandas as pd
  from sendgrid import SendGridAPIClient
  from sendgrid.helpers.mail import Mail
  
  db = pd.read_csv('changes.csv', delimiter = ",", skiprows=6)   
  db["Email"] = "add@test.com"     
  
  db = db.drop_duplicates(subset = ["Employee Name"], keep = "first")
  
  field1 = db["Field Desc"] == "Status"
  field2 = db["Field Desc"] == "Default Cost Center 10 (Job)"
  
  message = Mail(
  from_email='test@test.com',
  to_emails='test@test.com',
  subject='{Employee} -- Kronos Change',
  html_content='''\
  
      We have received the change for {Employee}. 
  
      Title: {Title}
  
      Old: {Old}
  
      New: {New}
  
      Profit Center: {PC}
  
      Supervisor: {Supervisor}
  
      ''')
  
  message.content = Content("text","changes.csv")
  
  try:
  sg=SendGridAPIClient(os.environ.get('API KEY'))
  response = sg.send(message)
  print(response.status_code)
  print(response.body)
  print(response.headers)
  except Exception as e:
  print(e.message)
  </code></pre>
  
  <p>I am not sure if message.content is the correct to call to read from a csv file. Some of this code is what worked for me when I used smtplib.</p>