Graphs in xlsx File overwrite by openpyxl

前端 未结 2 1417
无人及你
无人及你 2021-01-25 03:25

We need to update xlsx sheet using python script which do some calcualtion and update one worksheet. I choose openpyxl as it supoort writing/updating xlsx File. In the Excel she

相关标签:
2条回答
  • 2021-01-25 03:57

    Any graphs that exist in the document before opening will be deleted after saving. The only way around this ( i know of) is to create the chart in code.

    Here is the documentation on how to create a chart in openpyxl

    The example is a little broken, compare to this instead.

        values = Reference(ws, (1, 1), (1, 95))
        series = Series(values, title="Sample" )
        chart = LineChart()
        chart.append(series)
        ws.add_chart(chart)  
    
    0 讨论(0)
  • 2021-01-25 04:06

    Openpyxl does not support graphs or chart as of now

    0 讨论(0)
提交回复
热议问题