Reputation: 11039
How can I read values from named ranges in Excel with openpyxl?
I've found the sourcecode at http://openpyxl.readthedocs.org/en/latest/_modules/openpyxl/workbook/names/named_range.html but I can't figure out how to use it properly.
Upvotes: 11
Views: 17626
Reputation: 181
wb = openpyxl.load_workbook(excel_file_name)
rng = wb.get_named_range(name_of_range).destinations[0]
sheet = rng[0]
address = rng[1].replace('$','')
val = sheet[address].value
Upvotes: 12