Results = dict()
wb = xl.open('file', keep_vba=True, read_only=True)
Results['Global defined names'] = dict()
for name in wb.defined_names:
Results['Global defined names'][name] = dict()
Results['Global defined names'][name]['Name'] = wb.defined_names[name].name
Results['Global defined names'][name]['Type'] = wb.defined_names[name].type
Results['Global defined names'][name]['Value'] = (wb.defined_names[name].
value)
Results['Sheets'] = dict()
for ws in wb.worksheets:
Results['Sheets'][ws.title] = dict()
Results['Sheets'][ws.title]['Visibility'] = ws.sheet_state
Results['Sheets'][ws.title]['Sheet defined names'] =\
list(ws.defined_names.keys())
# Fails at the line below
if ws.protection.sheet is True:
Results['Sheets'][ws.title]['Protection'] = 'Protected'
else:
Results['Sheets'][ws.title]['Protection'] = 'Unlocked'