Re: [openpyxl-users] Sava excel chart as image

604 views
Skip to first unread message

Charlie Clark

unread,
Feb 8, 2022, 5:29:06 AM2/8/22
to openpyxl-users
On 8 Feb 2022, at 7:56, Gilbert Temgoua wrote:

> Hello everyone,
>
> I've been trying to save an excel chart as image to my local disk, using
>
> openpyxl but still can't find how. I wish *openpyxl.chart.bar_chart.BarChart
>
> *object could have a method *save()* for this sake but no.
>
> Does anyone have an idea of how to achieve this?

It's not possible to do this with openpyxl. In Excel files charts are merely abstract descriptions with references to cells. Applications like Excel turn these descriptions into what you see (this is also called rendering) and are able to save them as bitmaps.

Sometimes you can get the applications to do this programatically using macros, or APIs but it might in many cases be better to use a Python graphics library like MatPlotLib or Seaborn or one of the many others to do this for you.

Charlie

--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Sengelsweg 34
Düsseldorf
D- 40489
Tel: +49-203-3925-0390
Mobile: +49-178-782-6226
Reply all
Reply to author
Forward
0 new messages