I am trying to extract table from a PPT using python-pptx
, however, the I am not sure how do I that using shape.table
.
from pptx import Presentation
prs = Presentation(path_to_presentation)
# text_runs will be populated with a list of strings,
# one for each text run in presentation
text_runs = []
for slide in prs.slides:
for shape in slide.shapes:
if shape.has_table:
tbl = shape.table
rows = tbl.rows.count
cols = tbl.columns.count
I found a post here but the accepted solution does not work, giving error that count
attribute is not available.
How do I modify the above code so I can get a table in a dataframe?
EDIT
Please see the image of the slide below
This appears to work for me.