Retrieve shared formulas #67
No reviewers
Labels
No Label
DBF
Dates
Defined Names
Features
Formula
HTML
Images
Infrastructure
Integration
International
ODS
Operations
Performance
PivotTables
Pro
Protection
Read Bug
SSF
SYLK
Style
Write Bug
good first issue
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#67
Loading…
Reference in New Issue
No description provided.
Delete Branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implement 18.3.1.40
Coverage increased (+0.05%) when pulling
131fa7d034
on Y--:master intoc91e94dbbb
on SheetJS:master.@Y-- apologies for the belated reply -- busy day :/
I just added some test files. Take a look at https://github.com/SheetJS/test_files/raw/master/formulae_test_simple.xlsx -- something looks off:
@SheetJSDev thanks for taking a look at my PR.
You're right the current code give only the "master" formula according to specs.
We would need to "recompute" it based on it's relative position inside the shared group.
Is there any code for that in
js-xlsx
already?It looks like we'd need a bona-fide Excel formula parser to do this right, ideally something that converts to the parsed things format that XLS and XLSB use. The grammar for the tokens is laid out in MS-XLSB 2.5.97.88 (http://msdn.microsoft.com/en-us/library/dd946774.aspx) and MS-XLS 2.5.198.104 (http://msdn.microsoft.com/en-us/library/dd908135.aspx). I can look into this later
Ok great. Should we put the master formula in a other field in the meantime ?
@Y-- For now, it might make sense to add an array
!shrfmla
to the workbook (just like how merges are currently held) which holds the master formula as well as other relevant information.For example, in the example, the first shared formula is:
In this case, we'd need to store the actual formula
A2
as well as the refC2:C6
and the original cell (the index would match the position in the shared formula array)Coverage increased (+4.69%) when pulling
30b976932e
on Y--:master intoc91e94dbbb
on SheetJS:master.Coverage increased (+4.93%) when pulling
be824970e6
on Y--:master intoc91e94dbbb
on SheetJS:master.What ended up happening with this PR?
Hi, bumping this. I've made a private fork of XLSX JS and have created a true blue formula parser and resolver... and I'm just now running into this little issue... the shared formula thing is a big issue and I am wondering if anyone has any documentation about the rules that govern shared formulas and how I can make inferences from the data in the XML and generate the appropriate formulas. I'm pretty much ready to build this, I just need more data to pursue it.
Doing the corporate dance to try and get my work on parsing/resolving into your repo, not easy, but I think you guys would be quite happy with what I've created.
If I could make a request of the group, one of the most immediate barriers is the shared attribute is currently not even being parsed and added to the dictionary. If that could be done then I could do a merge and start cranking...
This was addressed in 0.8.4. XLSX XLSB XLS and SpreadsheetML now parse shared and array formulae.
In XLSX, the raw shared formula is stored in the upper left cell along with a shared id
si
attribute. Cells referencing the formula include thatsi
attribute. The parser calculates a delta and applies it to the relative references in the formula.The current iteration uses a very simple regex which only fail on some special cases that can be refined with a more precise regular expression. @jasconius I originally thought a proper parser was needed but in retrospect a fine tuned regular expression can work (Excel itself prohibits defined names that potentially collide with a valid cell address).
Pull request closed