I would like to update data in a Bar chart, but I am getting error at the step of accessing the object holding the chart. Here is code that gives me shape_id:
shp=prs.slides[0].shapes
for shape in shp:
print(
"id: %s, type: %s, name: %s"
% (shape.shape_id, shape.shape_type, shape.name)
)
# => **Output:** id: 7, type: CHART (3), name: Chart 6
But, when I try to use shape_id to define chart object, I am getting below error: chart = prs.slides[0].shapes[7].chart
Error:
raise IndexError("shape index out of range")
IndexError: shape index out of range
I also tried this code: chart = shp._spTree.shape_id[7].chart
Error:
TypeError: 'int' object is not subscriptable