vallettea / koala

Transpose your Excel calculations into python for better performances and scaling.
GNU General Public License v3.0
147 stars 59 forks source link

Spaces in tab names #173

Closed Brad-eki closed 5 years ago

Brad-eki commented 5 years ago

Errors on processing a tab called 'Data Filters', Koala thinks it's called 'DataFilters'!C4.

When I use an underscore the problem goes away.

I might be able to get to the bottom of this, but I'll have to come back later...

Traceback (most recent call last):
  File "C:\Users\me\AppData\Local\Continuum\anaconda3\envs\koala\lib\site-packages\win32com\server\policy.py", line 278, in _Invoke_
    return self._invoke_(dispid, lcid, wFlags, args)
  File "C:\Users\me\AppData\Local\Continuum\anaconda3\envs\koala\lib\site-packages\win32com\server\policy.py", line 283, in _invoke_
    return S_OK, -1, self._invokeex_(dispid, lcid, wFlags, args, None, None)
  File "C:\Users\me\AppData\Local\Continuum\anaconda3\envs\koala\lib\site-packages\win32com\server\policy.py", line 586, in _invokeex_
    return func(*args)
  File "C:\Users\me\Documents\Python\xlwings\xlwings\server.py", line 198, in CallUDF
    res = call_udf(script, fname, args, this_workbook, FromVariant(caller))
  File "C:\Users\me\Documents\Python\xlwings\xlwings\udfs.py", line 311, in call_udf
    ret = func(*args)
  File "c:\users\me\documents\python\{OBSCURED}.py", line 107, in FILTERED
    generateModelGraph(filter_name)
  File "c:\users\me\documents\python\{OBSCURED}.py", line 33, in generateModelGraph
    athing = excel_compiler.gen_graph(inputs= inputs, outputs= [model.name.name])
  File "C:\Users\me\AppData\Local\Continuum\anaconda3\envs\koala\lib\site-packages\koala2-0.0.29-py3.7.egg\koala\ExcelCompiler.py", line 113, in gen_graph
    virtual_cell = Cell(i, None, value = self.cells[reference].value, formula = reference, is_range = False, is_named_range = True)
KeyError: "'DataFilters'!C4"
danielsjf commented 5 years ago

@Brad-eki, this pull request seems to solve your issue as described. Could you test it on your case?

danielsjf commented 5 years ago

I also added a test which passes now. If your problem is more specific, could you add an example?