首页 > 解决方案 > Pandas ExcelWriter 断开了来自 web 的 excel 外部连接

问题描述

我的意图是将数据框附加到现有的 excel 文件中。这个 excel 文件有一个名为“价格”的工作表,这个工作表有一个来自 Web 的外部连接。

当我运行代码(如下)并附加数据框时,连接消失了。

有什么推荐吗?

#Export to excel
options = {}
options['strings_to_formulas'] = False
options['strings_to_urls'] = False
path = 'Produtos.xlsx'
book = load_workbook(path)
writer = pd.ExcelWriter('Produtos.xlsx', engine='openpyxl',options=options)
writer.book = book
writer.sheets = {ws.title: ws for ws in book.worksheets}
BDR_df.to_excel(writer, sheet_name='BDR', index = False)
writer.close()
writer.handles = None

标签: pythonexcelpandasopenpyxlexport-to-excel

解决方案


推荐阅读