Read values from named ranges with openpyxl

前端 未结 1 959
误落风尘
误落风尘 2020-12-16 03:10

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/na

相关标签:
1条回答
  • 2020-12-16 03:48
    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
    
    0 讨论(0)
提交回复
热议问题