-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Corrupted XLSX output due to invalid sheet name #705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@loreanvictor you are right, |
@Siemienik Any ideas how to validate correctness of excel? maybe I will try to create pull request. |
@omurbekjk somethink like that works for me: name = name.replace(/[\\\/*\[\]?]/g, '.'); //replace forbidden chars
if (!scope.isUnique(name))) { //name has to be unique
name = scope.next(name); // append 1,2,3...
}
name = name.length > 31 ? name.substr(name.length - 31) : name; //max 31 letters |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So I noticed that while some softwares could open generated XLSX files using
exceljs
(like Numbers on MacOS and Google Sheets), Microsoft Excel (or Excel Online) was unable to open the files, giving me an error indicating that the file is corrupted. After simplifying the code and isolating the issue, I realized that for some reason MS Excel assumes a maximum length of 31 characters for Worksheet titles and as a result was deeming the generated file corrupt.So basically, this snippet works fine:
While this one doesn't:
Since MS Excel is what most end-users will use to open automatically generated files by a web-service, I would highly recommend adding an error/warning message for when this case occurs, a toggle-able validation that is on by default, or at least a hint to the documentation.
The text was updated successfully, but these errors were encountered: