I am trying to embed an excel file with data to a powerpoint file, but when I run the code, it adds an empty excel file instead of the excel file which has data (Test.xlsx).
Below is the code I ran,
from pptx import Presentation
from pptx.util import Inches
ppt = Presentation()
title_slide = ppt.slides.add_slide(ppt.slide_layouts[0])
title_slide.shapes.add_ole_object('Test.xlsx', 'Excel.Sheet', left = Inches(1), top = Inches(3))
ppt.save('Test.pptx')
This is documentation I referred,
https://python-pptx.readthedocs.io/en/latest/api/shapes.html
I am unsure if I am running it incorrectly. I would appreciate any advice on this.
I was able to resolve this, so for the Prog_ID, instead of 'Excel.Sheet' I had to use PROG_ID.XLSX. I imported PROG_ID using 'from pptx.enum.shapes import PROG_ID'. In case anyone has this problem, hopefully this helps.
Source: github.com/scanny/python-pptx/issues/752