Given below is the code I'm running. What I'm trying to achieve is simple. I need to copy a chart from an existing Excel file & paste as a chart (NOT image) into an existing PowerPoint slide.
But I always get the error
"AttributeError: 'Sheet' object has no attribute 'Shapes'"
Is there any package I'm supposed to install?
from pptx import Presentation
import xlrd
import math
import xlutils
import win32com.client
from win32com.client import constants
prs = Presentation('D:\Sruti K\Online_Retail\APAC\Office Slides\Office QBU Slides\FY17 Q4 June\Office Slides FY17 Q4 test.pptx')
title_slide_layout = prs.slide_layouts[3]
slide = prs.slides.add_slide(title_slide_layout)
book = xlrd.open_workbook(r'D:\Sruti K\Online_Retail\APAC\Office Slides\Office QBU Slides\FY17 Q4 June\Python Chart Paste.xlsx')
ws = book.sheet_by_index(0)
sheetsinbook=[book.sheet_by_index(0)]
for ws in sheetsinbook:
for chart in ws.Shapes():
chart.Activate()
chart.Copy()
slide.Shapes.PasteSpecial(constants.ppPasteShape)
Print("hi")
prs.save(r'D:\Sruti K\Online_Retail\APAC\Office Slides\Office QBU Slides\FY17 Q4 June\Python Trial APAC PPT V1.pptx')