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.

Negative Percent on cell

See original GitHub issue

Hello, The Excel table has a cell with value : -5% The XLSX.utils.sheet_to_json return : -0

Positive value works perfectly, only Negative value do not.

Is there something i need change in reading? var data = XLSX.utils.sheet_to_json(first_worksheet, {header:1});

image

The Excel file : image

Note : I am using the the js-xlsx insude adobe extendscript

Appreciate your help, Firas.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
SheetJSDevcommented, Apr 4, 2017

If you pass {raw:true} to the sheet_to_json function it should give you the number!

For example, with that pct.xlsx file from earlier:

// normal behavior
XLSX.utils.sheet_to_json(wb.Sheets.Sheet1,{header:1})
[
  [ '0.8', '-0.05' ], 
  [ '80%', '-5%' ]
]


// if you add raw:true to the options, it will give you the number
XLSX.utils.sheet_to_json(wb.Sheets.Sheet1,{header:1,raw:true})
[
  [ 0.8, -0.05 ],
  [ 0.8, -0.05 ]
]
0reactions
reviewhercommented, Apr 4, 2017

#608 covers the general issue of the formatting in ExtendScript, so I think we’re done here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parentheses for Negative Percent Results in Excel - Officetuts
To display positive percentages use the code ###0.00%, and to display negative percentages within parentheses use the code (###0.00%).
Read more >
Displaying Negative Percentages in Red - Excel Ribbon Tips
Select the cell (or cells) that may contain negative percentages. · Display the Home tab of the ribbon. · Click the small icon...
Read more >
Parentheses for Negative Percent Results - RESOLVED
I have been able to format single cells to display negative percents (Budget to Actual hours), but I cannot copy the formatting to...
Read more >
Displaying Negative Percentages in Red in Excel - Causal
One way is to use the conditional formatting feature within Excel. This is a quick and easy way to format your cells based...
Read more >
Calculate Percentage Change for Negative Numbers in Excel
We could use this same methodology to tell our readers if the change was positive (P) or negative (N) when either value is...
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