read_powerpoint_charts

read_powerpoint_charts(path)

Read every chart in a PowerPoint presentation.

Parameters

Name Type Description Default
path str, os.PathLike or binary file object A .pptx or .pptm presentation, or a .ppsx or .potx one, or an open binary stream of one, such as an uploaded file. required

Returns

Name Type Description
list of PowerPointChart One per chart maidr can read, slide by slide in slide show order and, on a slide, in the order of its shapes. Charts on hidden slides are included and say so. Pass one to :func:maidr.show, :func:maidr.render or :func:maidr.save_html.

Raises

Name Type Description
NotAPresentationError If the file is not a .pptx presentation: an older .ppt file, an Excel workbook or a Word document, or a Strict Open XML presentation. A ValueError.

Notes

Every chart type :func:maidr.read_excel_charts reads is read, and read the same way: a chart on a slide is the same chart part, with the copy of its values PowerPoint drew and its data in a workbook embedded in the presentation. That workbook is read only for what the copy leaves out, such as the header cell that names a category axis with no title. Each chart is drawn in the colors of its slide’s theme.

Examples

>>> import maidr
>>> for chart in maidr.read_powerpoint_charts("deck.pptx"):
...     maidr.save_html(chart, f"slide-{chart.slide}-{chart.name}.html")