第一句子网 - 唯美句子、句子迷、好句子大全
第一句子网 > python解析excel公式_[python][openpyxl]读取excel中公式的结果值

python解析excel公式_[python][openpyxl]读取excel中公式的结果值

时间:2019-02-05 19:42:21

相关推荐

python解析excel公式_[python][openpyxl]读取excel中公式的结果值

要读取cell中的值,但是,如果cell中的值是一个公式,则读取出来的是公式。有时候我们希望读取到公式计算出来的结果,可以使用load_workbook()中的data_only属性。

load_workbook()中涉及到的全部属性,其中,read_only用于打开一个大空间的xlsx文件(否则会产生MemoryError问题——内存爆了),data_only用于读取cell中的值(如果cell中的值是公式,则会返回计算得到的值)

filename (string or a file-like object open in binary mode c.f., zipfile.ZipFile) – the path to open or a file-like object

read_only (bool) – optimised for reading, content cannot be edited

keep_vba (bool) – preseve vba content (this does NOT mean you can use it)

guess_types (bool) – guess cell content type and do not read it from the file

data_only (bool) – controls whether cells with formulae have either the formula (default) or the value stored the last time Excel read the sheet

keep_links (bool) – whether links to external workbooks should be preserved. The default is True

View Code

原文链接:/tankloverainbow/article/details/80872901

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。