Skip to content
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

I fixed error with NaN in merged cells #203

Open
Magentai opened this issue Apr 22, 2024 · 0 comments
Open

I fixed error with NaN in merged cells #203

Magentai opened this issue Apr 22, 2024 · 0 comments

Comments

@Magentai
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

I fixed error with NaN in merged cells:

diff --git a/node_modules/node-xlsx/lib/xlsx/xlsx.js b/node_modules/node-xlsx/lib/xlsx/xlsx.js
index c626943..29fff59 100644
--- a/node_modules/node-xlsx/lib/xlsx/xlsx.js
+++ b/node_modules/node-xlsx/lib/xlsx/xlsx.js
@@ -136,7 +136,7 @@ function xlsx(file, options) {
 					cell = columns[k];
 					f = styles[+getAttr(cell, 's')] || { type: 'General', formatCode: 'General' };
 					t = getAttr(cell, 't') || f.type;
-					val = cell.substring(cell.indexOf('<v>') + 3, cell.indexOf('</v>'));
+					val = cell.indexOf('<v>') !== -1 ? cell.substring(cell.indexOf('<v>') + 3, cell.indexOf('</v>')) : undefined;
 					val = val ? +val : ''; // turn non-zero into number
 					switch (t) {
 						case 's': val = sharedStrings[val]; break;

This issue body was partially generated by patch-package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant