Repository navigation
xlsx reader: optionally keep cell references, formulas, hidden rows and comments #12038
Closed
nachogarcia
started this conversation in
Ideas
Replies: 1 comment
|
To make the proposal concrete, #12039 implements it as a draft. On 73 real-world workbooks, its formula text, including shared formulas, matches openpyxl's for all 27,834 formulas. Happy to change the name or any part of it according to what's decided here. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The xlsx reader gives each cell only its cached value, plus bold and italic. That's right for reading a workbook as a document. It loses what you need to check a workbook, though, such as one behind a table or figure in a paper:
=AVERAGE(L30:L44), where the author meantL30:L49, reads as just its result. That is the error at the heart of the Reinhart–Rogoff dispute.72 of the 73 real-world workbooks I've been testing with contain formulas.
The AST already has a place for this: rows and cells carry attributes. So I'd propose an extension, off by default, like the docx reader's
styles, that adds:ref="B20"to every cell;formula="AVERAGE(B5:B19)"to every cell holding a formula, written as stored. Shared formulas would be expanded, so each cell gets its own references;comment="..."to a cell with a comment;hiddenclass on hidden rows, on the cells of hidden columns, and on the heading of a hidden sheet.HTML, JSON and native output keep these attributes, and Lua filters can use them. The Markdown writers drop them, so anyone wanting them in Markdown would render them with a filter, for example by appending the formula to the cell's text.
Questions:
All reactions