title: Export Charts from Excel as images using Python
body: <p>I have been trying to export the charts from Excel as an image file (JPG or ING) in Python. I am looking at the WIn32com. Here is what I have till now.</p>
  
  <pre><code>import win32com.client as win32
  excel = win32.gencache.EnsureDispatch("Excel.Application")
  wb = excel.Workbooks.Open("&lt;WORKSHEET NAME&gt;")
  r = wb.Sheets("&lt;SHEET NAME&gt;").Range("A1:J50") 
  # Here A1:J50 is the area over which cart is
  r.CopyPicture()
  </code></pre>
  
  <p>This is where I am stuck. I need to copy the selected range to a file now. Any help or pointers towards the doc can help me a lot.</p>
  
  <p>I have modelled the above code based on the following VBA script:</p>
  
  <pre><code>Sub Export_Range_Images()
      ' =========================================
      ' Code to save selected Excel Range as Image
      ' =========================================
      Dim oRange As Range
      Dim oCht As Chart
      Dim oImg As Picture
  
      Set oRange = Range("A1:B2")
      Set oCht = Charts.Add
      oRange.CopyPicture xlScreen, xlPicture
      oCht.Paste
      oCht.Export FileName:="C:\temp\SavedRange.jpg", Filtername:="JPG"
  End Sub
  </code></pre>
  
  <p>Code Snippet from : <a href="http://vbadud.blogspot.com/2010/06/how-to-save-excel-range-as-image-using.html" rel="noreferrer">http://vbadud.blogspot.com/2010/06/how-to-save-excel-range-as-image-using.html</a></p>