Repository navigation
xlsb: read references to sheets of other workbooks in formulas - #783
Open
Alex-ley-scrub wants to merge 1 commit into
Open
Alex-ley-scrub wants to merge 1 commit into
Alex-ley-scrub wants to merge 1 commit into
Conversation
Fixed issue where xlsb formula references to a sheet of another workbook were read as a sheet of this workbook. Co-authored-by: sjvrensburg <sjansevanrensburg@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixed issue where xlsb formula references to a sheet of another workbook were read as a sheet of this workbook.
Each entry of
BrtExternSheetnames a supporting workbook and a sheet index in that workbook, but only the sheet index was used, and it was looked up in this workbook's sheets. So a reference to the second sheet of another workbook was read as this workbook's second sheet, with nothing to show it was wrong.The supporting workbooks are now read in order from
BrtSupBookSrc(another workbook) andBrtSupSelfandBrtSupSame(this workbook). The sheet names of another workbook come from theBrtSupTabsrecord of its external link part. A reference to another workbook is written the way it's stored in xlsx, with the workbook's number:[1]Data!$A$1. Workbooks without supporting workbook records are read as before.=[ext_a.xlsx]Data!$A$1Sheet1!$A$1[1]Data!$A$1=SUM([ext_a.xlsx]Second!$A$1:$A$2)SUM(Sheet2!$A$1:$A$2)SUM([1]Second!$A$1:$A$2)=[ext_b.xlsx]Data!$A$1Sheet1!$A$1[2]Data!$A$1=Sheet2!$A$1Sheet2!$A$1Sheet2!$A$1Related issue
None. The same bug was reported in #717, which has since been closed. This writes the other workbook's sheet name, as xlsx does, instead of its sheet index.
Testing
tests/formula_external_sheets.xlsbwas created in Excel for Mac and saved as.xlsb. Sheet1 column A refers to sheets of two other workbooks,ext_a.xlsxandext_b.xlsx, and to its own Sheet2, and column B holds each formula as text. In this file Excel writes this workbook'sBrtSupSelfafter the twoBrtSupBookSrcrecords. The same workbook saved as.xlsxstores the formulas as[1]Data!$A$1,SUM([1]Second!$A$1:$A$2)and[2]Data!$A$1.test_xlsb_formula_external_sheetschecks all four formulas. It fails without the fix.Checklist
cargo test --all-featurespasses.cargo fmt -- --checkpasses.cargo clippy --all-targets --all-features -- -Dwarningspasses.Other information
The other workbooks aren't opened. A sheet name with spaces isn't quoted yet; #780 quotes sheet names, and I'll extend it to these references once one of the two is merged.