question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Number stored as Text error

See original GitHub issue

In my code I’m formatting the numbers to strings with commas separators this way: num.toLocaleString('en') in order to get something like that: acreen The problem is that this green sign appears and writes me “Number stored as Text” and that I need to convert it back to number manually. I didn’t find a feature that enables excel 1000 separator or ignores errors in this package. Is there something to do with it?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:11

github_iconTop GitHub Comments

3reactions
KatElizabethcommented, Jul 17, 2020

Hi, I was able to find solution for this. You have to return Number and numFmt should be #,#

Can you elaborate please?

When he says you need to return number, it means the type of data you are putting into exceljs for that row or column, should be a Number and not a string. Instead of using the toLocaleString, maybe you can just write in code the format you want so that it is never a string and uses something else to place decimals etc. Like in angular, I use the number pipe: {{yourField | number: ‘1.2-2’}}

When he’s talking about number formats, numFmt, I am fairly sure he is referencing actual excel number formats, which is what you put into your code when exporting. You can read about excel number formats here: https://www.excel-easy.com/examples/custom-number-format.html

For me, I had been using the method toFixed() on my data to get 2 decimal places, and it was turning it into a string. I removed that to keep it as a number, and when exported to excel, I no longer have the issue.

3reactions
junaidinamcommented, Jan 9, 2019

Hi, I was able to find solution for this. You have to return Number and numFmt should be #,#

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix text-formatted numbers by applying a number format
Click the File tab. · Under Help, click Options. · In the Excel Options dialog box, click the Formulas category. · Under Error...
Read more >
How to Fix All Number Stored as Text in Excel (6 Easy Solutions)
6 Solutions to Fix All Number Stored as Text in Excel · First, add a new column. · After that, select the first...
Read more >
Fixing Numbers Stored as Text | Getting Data onto a ... - InformIT
When numbers in a sheet are being stored as text, Excel lets you know by placing a green triangle in the cell (if...
Read more >
How to Fix Numbers Stored as Text in Excel - Officetuts
To resolve the issue, all you need to do is select the range, then go to Data >> Text to Columns: When we...
Read more >
What's the deal with numbers being stored as text in Microsoft ...
Somehow you inadvertently caused Excel to see your numbers as text. This can happen for a few reasons: You imported it from a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found