Created
December 21, 2017 21:29
-
-
Save empiricalthought/3f0b3a501720b87d4a4c4f0b7e372e62 to your computer and use it in GitHub Desktop.
openpyxl named range
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from openpyxl import load_workbook | |
workbook = load_workbook(filename='./tmp/book.xlsx', read_only=True) | |
range = workbook.defined_names['a_named_range'] | |
for sheet_title, sheet_coords in range.destinations: | |
sheet = workbook[sheet_title] | |
for row in sheet[sheet_coords]: | |
print "\t".join(str(cell.value) for cell in row) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment