首页 > 解决方案 > 使用 plotly 和 xlwings 将 html 添加到 excel 中

问题描述

我创建了一个生成为 HTML 文件的绘图图。我能够运行脚本并将图表作为 PNG 文件嵌入到 Excel 中。有没有办法将其嵌入为 HTML 文件?

部分代码如下

import xlwings as xw
import pandas as pd
import plotly.graph_objs as go
import plotly.io as pio

fig = dict(data=data, layout=layout)
file = 'filename.png'
pio.write_image(fig, file)
xw.sheets.active.pictures.add(file, name='pyxl', update=True)

标签: pythonplotly-pythonxlwings

解决方案


推荐阅读