[英]Can Openpyxl read array formulae from excel?
I am creating a tool that reads excel formula in order to do some analysis on the functions used.我正在创建一个读取 excel 公式的工具,以便对所使用的函数进行一些分析。 I am currently using openpyxl
to read in the formulae of an excel workbook, but I am encountering an issue where array formula are read in as an equals sign only, ie, =
.我目前正在使用openpyxl
来读取 excel 工作簿的公式,但我遇到了一个问题,即数组公式仅作为等号读取,即=
。
The code I am using to read the formulae is:我用来阅读公式的代码是:
wb = openpyxl.load_workbook(book, data_only=False)
An array formula is of the form {=SUM(LEN(B2:B11))}
or ={formula}
数组公式的形式为{=SUM(LEN(B2:B11))}
或={formula}
It seems to be the curly braces {
which cause the issue.似乎是花括号{
导致了问题。 Has anyone experienced this issue before, or know of a workaround (using a different library if necessary) for this issue?有没有人以前遇到过这个问题,或者知道这个问题的解决方法(如有必要,使用不同的库)?
Cheers,干杯,
Matthew马修
Array formulae are currently (openpyxl 3.0.x) stored separately in the ws.formula_attributes
dictionary.数组公式目前(openpyxl 3.0.x) 单独存储在ws.formula_attributes
字典中。
The curly brackets for array formulae and data tables (coming) are GUI-only artefacts.数组公式和数据表(即将推出)的大括号是仅限 GUI 的人工制品。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.