首页 > 解决方案 > Jupyter Notebook 正在从我的 Excel 工作表中删除形状

问题描述

我成功地将 Excel (.xlsx) 文件上传到我的 Jupyter Notebook。这是 Excel 工作表的样子:在此处输入图像描述

使用我的代码,我设法使用以下代码在“进入 DGS1 的流程”(单元格 K13)下方的单元格中写入了一个值:

import openpyxl

#the name of my workbook
wbkName = 'DGS Tool interface.xlsx'
wb_obj = openpyxl.load_workbook(wbkName)
sheet_obj = wb_obj.active

#I want to write into the cell at row 13 and column 11
Leakage_cell=sheet_obj.cell(row=13,column=11)

#The value written in this cell is obtained with a function I built called "Leakage"
Leakage_cell.value=Leakage(1000,200)

#Save the changes so that the newly written value appears in my workbook
wb_obj.save(filename = 'DGS Tool interface.xlsx') 

现在,当我运行代码后重新下载笔记本时,值已成功写入单元格,但所有箭头和“非单元格”元素都被删除,如下所示:

在此处输入图像描述

有谁知道如何让 Jupyter 保留 Excel 工作表的所有图像?提前致谢!

标签: pythonexceljupyter-notebookopenpyxl

解决方案


推荐阅读