Skip to main content
 首页 » 编程设计

python之xlsxwriter:有没有办法定义 "named cell"

2024年10月25日1098°冷暖

In excel您可以命名一个单元格或单元格区域。这个“命名单元格”在公式中特别有用。例如 =countif(EmployeeStatus, "Full Time") 比 =countif($B$2:$B$102, "Full Time") 更具描述性。

此功能是否内置于 xlsxwriter 中?

谢谢。

请您参考如下方法:

不,我不相信它是。我没有在任何地方的文档中看到它。 https://xlsxwriter.readthedocs.org/working_with_cell_notation.html “Cell Utility Functions”不包括它。 为它提出一个功能请求可能会很好。

更新

他们张贴在 github这样做的方法。 (它使用工作簿,而不是单元格,所以我找错地方了。)

That is possible in XlsxWriter using the workbook define_name() method, see the docs and the example program.

文档中的例子是:

workbook.define_name('Sales', '=Sheet1!$G$1:$H$10')