Reputation: 3301
i am looking for a python function to check if any of the excel rows are hidden or not ?
i have a folder with 30 excels , need to check if some of the rows are hidden in any of the sheets.
Upvotes: 0
Views: 1711
Reputation: 121
Try the following if your file is an .xls file:
import xlrd
workbook = 'path to your xls file'
wb = xlrd.open_workbook(workbook, formatting_info=True)
ws = wb.sheet_names()
test_sheet = wb.sheet_by_name(ws[0])
#assuming my 4th row is hidden
row_state = test_sheet.rowinfo_map[3].hidden
#assuming my 3rd column is hidden
col_state = test_sheet.colinfo_map[2].hidden
Setting formatting_info=True is important.
Upvotes: 1
Reputation: 13581
You can use XLRD Python module to parse XLS files. To check if cell is hidden you can use Rowinfo and Colinfo classes and their hidden field.
Upvotes: 2