使用openpyxl查找隐藏的单元格 [英] Finding hidden cells using openpyxl

查看:472
本文介绍了使用openpyxl查找隐藏的单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试编写一个脚本,以将格式从一个工作簿复制到另一个工作簿,并且像处理openpyxl的任何人都知道的那样,这是一个很大的脚本.我已经使它工作得很好,但是我似乎无法弄清楚的一件事是,如果隐藏了列,如何从原始内容中读取内容.

I've been trying to write a script to copy formatting from one workbook to another and, as anyone dealing with openpyxl knows, it's a big script. I've gotten it to work pretty well, but one thing I can't seem to figure out is how to read from the original if columns are hidden.

任何人都可以告诉我在工作簿,工作表,列或单元格对象中的什么位置以查看隐藏的列在何处吗?

Can anyone tell me where to look in a workbook, worksheet, column or cell object to see where hidden columns are?

推荐答案

工作表具有row_dimensionscolumn_dimensions对象,这些对象包含有关特定行或列的信息,例如是否隐藏.列的尺寸也可以分组,因此在查看时需要考虑到这一点.

Worksheets have row_dimensions and column_dimensions objects which contain information about particular rows or columns, such as whether they are hidden or not. Column dimensions can also be grouped so you'll need to take that into consideration when looking.

这篇关于使用openpyxl查找隐藏的单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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