openpyxl读取公式值而不改变公式 [英] openpyxl read formula value without changing formula

查看:3350
本文介绍了openpyxl读取公式值而不改变公式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在xlsx文件中读取公式值,将值写入另一个单元格并存储xlsx文件。

I want to read the formula value in an xlsx file, write the value in another cell and store the xlsx file.

我正在使用data_only模式

I'm using the data_only mode

excelDoc = openpyxl.load_workbook(clientFile, data_only=True)

读取公式值。但是当我保存文件时,所有的公式都被它们的值覆盖。

to read the formula value. But when I save the file all formulas are overriden by their values.

我如何防止这个?

推荐答案

你不能。您可以使用值或公式。

You can't. You can either have the values or the formulae.

这篇关于openpyxl读取公式值而不改变公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆