I'd like to copy a range from an excel document into a powerpoint slide.
This is my attempt after reading through this documentation :
import win32com.client
powerpoint_object = win32com.client.Dispatch("Powerpoint.Application")
powerpoint_object.visible = True
powerpoint_presentation = powerpoint_object.Presentations.Open("example_powerpoint.pptx")
excel_object = win32com.client.Dispatch("Excel.Application")
excel_object.visible = True
excel_workbook = excel_object.Workbooks.Open(Filename="example_excel.xlsx")
excel_worksheet = excel_workbook.Worksheets("Sheet1")
excel_range = excel_worksheet.Range("A1:L100")
excel_range.Copy()
powerpoint_slide = powerpoint_presentation.Slides.Add(1,12)
powerpoint_slide.Shapes().Paste()
However I get the following error:
com_error: (-2147352567, 'Exception occurred.')