Allow formulas to reference cells in other sheets
Status: Alpha
Brought to you by:
rvk
This patch adds a feature that allows formulas to reference cells (and areas) in other sheets in the same workbook (references to external files not implemented).
Sheets can be referenced by name or by number (first sheet is 0). You can also reference a sequence of sheets.
Usage:
Formula('Sheet2!A1')
Formula('1!A1')
Formula('SUM(Sheet3!A1:B3)')
Formula('SUM(2!A1:B3)')
Formula('SUM(Sheet1:Sheet2!A1:B3)')
Formula('SUM(0:1!A1:B3)')
When running antlr to generate the parser it outputs some warnings, but it seems to work. Someone that understands parsers better than me should take a look and try to fix it.
Ruben Mendes
patch to allow formulas to reference cells in other sheets
Logged In: NO
The patch seems not to be valid for the 0.6.3a - at least with the current http://sourceforge.net/project/downloading.php?group_id=134081&use_mirror=ovh&filename=pyexcelerator-0.6.3a.zip&59710634
this patch yields errors.
Isn't there a 0.6.3b package available?
Logged In: NO
Sorry, I missed to attache the patch output:
$ patch -p0 -d . < 3dreferences.diff
patching file pyExcelerator/BIFFRecords.py
Hunk #1 FAILED at 2547.
1 out of 1 hunk FAILED -- saving rejects to file pyExcelerator/BIFFRecords.py.rej
patching file pyExcelerator/Cell.py
Hunk #1 FAILED at 79.
1 out of 1 hunk FAILED -- saving rejects to file pyExcelerator/Cell.py.rej
patching file pyExcelerator/excel-formula.g
patching file pyExcelerator/ExcelFormulaLexer.py
patching file pyExcelerator/ExcelFormulaParser.py
patching file pyExcelerator/ExcelFormula.py
Hunk #1 FAILED at 62.
Hunk #2 FAILED at 73.
2 out of 2 hunks FAILED -- saving rejects to file pyExcelerator/ExcelFormula.py.rej
patching file pyExcelerator/Row.py
Hunk #1 succeeded at 219 (offset -24 lines).
Hunk #2 succeeded at 227 (offset -24 lines).
patching file pyExcelerator/Workbook.py
Hunk #2 FAILED at 392.
Hunk #3 FAILED at 566.
Hunk #4 succeeded at 600 (offset -47 lines).
2 out of 4 hunks FAILED -- saving rejects to file pyExcelerator/Workbook.py.rej
patch unexpectedly ends in middle of line
Logged In: YES
user_id=866238
Originator: YES
The patch applies to SVN trunk.
Sorry but at the moment I do not have the time to backport it to 0.6.3a.
Logged In: NO
Perfect! This works like a charm!!
Thanks Ruben
Logged In: YES
user_id=1904493
Originator: NO
I don't understand how to apply the patch !!!
Does someone can explain it simply please
Logged In: YES
user_id=866238
Originator: YES
olivnath, you can apply the patch like this:
1 - Checkout from the repository
$ svn co https://pyexcelerator.svn.sourceforge.net/svnroot/pyexcelerator/trunk/pyExcelerator pyExcelerator
2 - Download the patch 3dreferences.diff available on the bottom of this page
3 - Apply the patch
$ cd pyExcelerator
$ patch -p1 < ../3dreferences.diff
Logged In: NO
This works fine, but it breaks if the worksheets have spaces in their names. (Eg SUM(My sheet!A1:B3) )
In Excel I think normally quotes are used: SUM('My sheet'!A1:B3)
Anyway, thanks for providing this.
How to patch 3dreferences.diff in windows?
Hmm. All of this parser stuff is beyond me, I'm afraid. Ruben, did you or anyone else ever figure out the warnings you were getting from antlr? Has anyone else worked on/with this in the last few years?