I was wondering if it's possible to take a dataframe that you created in python and have the values automatically populate in a PowerPoint line graph using the pptx-python package? I've looked at all of the examples that I could find and it seems you have to manually input the values that you want (see code below).
chart_data = ChartData()
chart_data.categories = ['Q1 Sales', 'Q2 Sales', 'Q3 Sales']
chart_data.add_series('West', (32.2, 28.4, 34.7))
chart_data.add_series('East', (24.3, 30.6, 20.2))
chart_data.add_series('Midwest', (20.4, 18.3, 26.2))
x, y, cx, cy = Inches(2), Inches(2), Inches(6), Inches(4.5)
chart = slide.shapes.add_chart(
XL_CHART_TYPE.LINE, x, y, cx, cy, chart_data
).chart
chart.has_legend = True
chart.legend.include_in_layout = False
chart.series[0].smooth = True
Is possible to automatically transfer what I have in my dataframe into the chart_data.categories and chart_data.add_series() sections so I don't have to type it all out? Or is it always manual entry?