Some filenames causes EXCEL to report error #2722
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#2722
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
Hi, attached is the file that has thrown an error by EXCEL. The fileName is:
RiskThemes_ Bubble Chart.xlsx
.I tried exporting with a fileName of
test.xlsx
and it is fine, so this must be a filename issue. I don't see anything wrong with the filenameRiskThemes_ Bubble Chart.xlsx
- it seems perfectly valid to me? Any ideas?Attached is the file.
RiskThemes_ Bubble Chart.xlsx
:
is missing from the bad characters list, feel free to submit a PRHi,
I had a look at the
xlsx.js
file and I wondered what the purpose ofcheck_ws_name
safe
param was, please? It is never used? Also the return value_good
never seems to be used?I also wondered, rather than throwing an Error when the filename contains "badchars" it would, perhaps, be better UX to simply replace them for the user?
This would have to be done in
book_append_worksheet
and thevarious
write methods so is a bigger change - e.g.To maintain the logic exactly as is with the throw, the following appears to be all we need as the safe parameter is always undefined and the return value is never used
In any event, forEach and looping through badchars converted to an array seems a little clunky. Please advise which of the above solutions would be preferable?
The latter solution is preferable (modifying
check_ws_name
).It's preferable to throw the error message as that is consistent with Excel. If you try to rename a worksheet to contain a
:
character, Excel throws an errorThe name does not contain any of the following characters: : \ / ? * [ or ]
The main reason not to autocorrect the worksheet name involves features like defined names and formulae. Suppose you were unaware of the Excel limitation and wrote a formula in a cell that used a cross-sheet reference (
='abc:def'!A1
). This formula would be incorrect if the worksheet is renamed. It is possible to write the formula in XLSX, but Excel treats it like an external reference. Small example: https://jsfiddle.net/dtshugz7/