Skip to content

Commit

Permalink
properly fixed #889, this can now also handle cases when refers to is…
Browse files Browse the repository at this point in the history
… a formula
  • Loading branch information
fzumstein committed Oct 19, 2018
1 parent 74e5a0d commit cd9fa33
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions xlwings/_xlmac.py
@@ -1,7 +1,7 @@
import os
import re
import datetime as dt
import subprocess
import unicodedata
import struct
import shutil
import atexit
Expand Down Expand Up @@ -1048,13 +1048,10 @@ def refers_to(self, value):

@property
def refers_to_range(self):
ref = self.refers_to[1:].split('!')
book = self.parent if isinstance(self.parent, Book) else self.parent.book
# appscript has issues when there are blanks or ' in sheet names (e.g. "foo' bar")
sheetname = ref[0]
if sheetname.startswith("'") and sheetname.endswith("'"):
ref[0] = sheetname[1:-1].replace("''", "'")
return Range(Sheet(book, ref[0]), ref[1])
external_address = self.xl.reference_range.get_address(external=True)
match = re.search(r"\](.*)!(.*)", external_address)
return Range(Sheet(book, match.group(1)), match.group(2))


class Shapes(Collection):
Expand Down

0 comments on commit cd9fa33

Please sign in to comment.