You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This doesn't seem like a big deal but wanted to document it. In a situation where we write a formula having an unnecessary space between the sheet name and range like =SUM('Sheet2'! A1:A5), Excel evaluates it, but pycel gives #NAME?
Checked other variations while I was at it:
fromopenpyxlimportload_workbookwb=load_workbook()
ws=wb['Sheet1']
ws['A1'] ='=SUM(\'Sheet2\'!A1:A5)'# no spacesws['A2'] ='=SUM(\'Sheet2\'! A1:A5)'# Excel can compute this, but pycel can'tws['A3'] ='=SUM (\'Sheet2\'!A1:A5)'# this is the only one that Excel can't computews['A4'] ='=SUM( \'Sheet2\'!A1:A5)'ws['A5'] ='=SUM(\'Sheet2\'!A1: A5)'ws['A6'] ='=SUM(\'Sheet2\'!A1 :A5)'
Thanks for reporting this. Ideally these things would be addressed in the tokenizer which is in openpyxl. I don't remember the context for the HACK comment I put in there referencing the openpyxl pull request. openpyxl had to move from bitbucket so that documentation is no longer there.
But as far as hacks go, I see nothing immediately wrong with what you are proposing. Do you fancy doing another PR?
What happened and code sample
This doesn't seem like a big deal but wanted to document it. In a situation where we write a formula having an unnecessary space between the sheet name and range like =SUM('Sheet2'! A1:A5), Excel evaluates it, but pycel gives #NAME?
Checked other variations while I was at it:
Here's the wb saved:
test_tokenizer.xlsx
I'm not really familiar with the tokenizer, but something like this fixes it
This is probably not the best way and might have unintended consequences though.
The text was updated successfully, but these errors were encountered: