Repository navigation
Keep constant error cells from an opened .xlsx, report them, write them back (#227) - #229
Merged
Merged
Conversation
…em back (#227) An error cell with no formula (<c t="e"><v>#DIV/0!</v></c>) opened blank because the importer had no branch for ExcelJS's { error } value, and a SUM over it came out as a clean number with nothing said. - excelIO: cellValueToRaw keeps the code as text (an error value once #226 lands). - excelIO: an exact Excel error code goes out as an error value, as Excel stores it, so a file that held #DIV/0! still reads #DIV/0! in Excel after a round trip. An apostrophe or the Text format keeps it text. - fileLosses: a new 'errorValues' kind counts constant error cells per sheet from the package; a formula whose result is an error is not counted, since it recalculates. - Both READMEs and both languages of the report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013pmWZsbmugfpqtYazrzfjj
…140 files Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013pmWZsbmugfpqtYazrzfjj
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013pmWZsbmugfpqtYazrzfjj
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Owner
Author
|
PO review — merged at Verify (local, full): green — 1990 tests, mutants 32/32 killed, a11y 119, e2e 57. CI 17/17 green on the same head. Tried as a user on a production build (
The two decisions asked for:
Next in the queue: #207 → #226 → #224. Generated by Claude Code |
This branch was successfully deployed
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.
What this changes
Closes #227. Queued right after #222, before #207.
The bug: a constant error cell, which Excel writes as
<c t="e"><v>#DIV/0!</v></c>with no formula, opened blank, and nothing said so.cellValueToRawinexcelIO.tshad no branch for ExcelJS's{ error }value, so it fell through to"". A total over it then came out as a clean number:=SUM(A1:A3)over#DIV/0!,#N/A,5read5.The fix (the minimum #227 asks for, until #226):
cellValueToRawreturns the error's code. The grid holds it as text for now, so it is visible and nothing is lost; it becomes a real error value once An error code typed, pasted or imported into a cell stays text, so formulas that read it go silently wrong #226 lands.errorValues, counts constant error cells per sheet, read from the package like every other kind. A formula whose result is an error is not counted, because the app calculates it again. Its line explains that the app shows them as text, so a formula that reads one does not see an error andSUMsteps over it, and that the exported file writes them back as error values.#NULL!#DIV/0!#VALUE!#REF!#NAME?#NUM!#N/A) goes out ast="e". A leading apostrophe or the Text format keeps it text.For PO: export changes for typed codes too
Writing the codes back as text was the smaller change, but it breaks the file in Excel itself. Open → export, and the file's own
=SUM(A1:A3)now reads5in Excel too, because#DIV/0!has become text. So export writes error values.That also covers a code someone types in the app:
#N/Atyped into a cell used to export as the text#N/A, and now exports as the error. That is what Excel does with#N/Atyped into a cell, and what #226 will do in the grid too. The way to keep it as text is the same as in Excel: an apostrophe ('#N/A) or the Text format. Only the exact spelling is matched (#n/astays text). I have not checked whether Excel accepts other spellings, so I did not guess.If you'd rather typed codes keep exporting as text until #226, the alternative is to remember which cells came in as errors. That is a new field on the sheet model, and it would have to survive saving, undo and copy. I don't recommend it for a step #226 replaces anyway.
Reproduced on
mainfirstA file written the way Excel writes it (the test checks the XML is
t="e"with no<f>):mainafter opening#DIV/0!#DIV/0!(text)t="e"#DIV/0!#N/A#N/A(text)t="e"#N/A5555=SUM(A1:A3)5, nothing said5, and the report says whySUMstill reading5in the app is #226's to fix; this PR makes it visible and keeps the file whole.How it was verified
npm run verify(all ten gates): all ten gates green on4088021(the current head), result belowexcelIO.test.ts(+3):t="e"cell opens as its code, not blank;t="e"and is still there on a reopen;'#N/Aand a Text-formatted#N/Aexport as text,#REF!typed as Excel spells it exports as the error, and#n/astays text.fileLosses.test.ts(+2):03aa574all five new tests fail (the importer gives"", export has not="e", the report is empty). The first assertion, that the test file really holdst="e"with no formula, passes on both.main5439196:mainplus this PR's 5);#DIV/0!and A2#N/Ain the grid instead of blank, A4 still reads5(An error code typed, pasted or imported into a cell stays text, so formulas that read it go silently wrong #226), and the report shows the new line with its sheet, in Thai and in English. No page errors.Anything reviewers should look at closely
t="e"cells. A sheet without the stringt="e"is skipped after oneincludes, so a plain file costs one string search per sheet.claude/new-session-m6mehm. The work was written on a local branch frommain03aa574, thenmain5439196(pivot: Sum, Average, Min and Max of a group with an error show the error (#222) #228, Pivot Sum/Average/Min/Max skip error values silently instead of showing the error #222) was merged in.🤖 Generated with Claude Code
https://claude.ai/code/session_013pmWZsbmugfpqtYazrzfjj
Generated by Claude Code