def destinations(self): if self.type == "RANGE": tok = Tokenizer("=" + self.value) for part in tok.items: if part.subtype == "RANGE": m = SHEETRANGE_RE.match(part.value) yield m.group('notquoted'), m.group('cells')
def _unpack_print_area(defn): """ Extract print area """ new = [] for m in SHEETRANGE_RE.finditer(defn.value): # can be multiple coord = m.group("cells") if coord: new.append(coord) return new
def _unpack_print_area(defn): """ Extract print area """ ranges = defn.value.split(",") # can be multiple new = [] for r in ranges: m = SHEETRANGE_RE.match(r) new.append(m.group('cells')) return new
def get_destinations(name_def): """Workaround for the bug in DefinedName.destinations""" from openpyxl.formula import Tokenizer from openpyxl.utils.cell import SHEETRANGE_RE if name_def.type == "RANGE": tok = Tokenizer("=" + name_def.value) for part in tok.items: if part.subtype == "RANGE": m = SHEETRANGE_RE.match(part.value) if m.group("quoted"): sheet_name = m.group("quoted") else: sheet_name = m.group("notquoted") yield sheet_name, m.group("cells")