(self, rangeStr)
| 1020 | # rangeStr: "A3:C12" or "D5" |
| 1021 | # example: for cell in _range("A1:Z12"): print cell |
| 1022 | def _range(self, rangeStr): |
| 1023 | rng = rangeStr.split(":") |
| 1024 | if len(rng) == 1: |
| 1025 | yield rangeStr |
| 1026 | else: |
| 1027 | start = re.match(r"^([A-Z]+)(\d+)$", rng[0]) |
| 1028 | end = re.match(r"^([A-Z]+)(\d+)$", rng[1]) |
| 1029 | if not start or not end: |
| 1030 | return |
| 1031 | startCol = start.group(1) |
| 1032 | startRow = int(start.group(2)) |
| 1033 | endCol = end.group(1) |
| 1034 | endRow = int(end.group(2)) |
| 1035 | col = startCol |
| 1036 | while True: |
| 1037 | for row in range(startRow, endRow + 1): |
| 1038 | yield col + str(row) |
| 1039 | if col == endCol: |
| 1040 | break |
| 1041 | t = 0 |
| 1042 | for i in col: t = t * 26 + ord(i) - 64 |
| 1043 | col = "" |
| 1044 | while t >= 0: |
| 1045 | col = chr(t % 26 + 65) + col |
| 1046 | t = t // 26 - 1 |
| 1047 | |
| 1048 | |
| 1049 | def convert_recursive(path, sheetid, outfile, kwargs): |
no outgoing calls
no test coverage detected