Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Currency format is excelJS

Tags:

exceljs

How do you format currency in exceljs?

All I've found is this from their docs...which I have no clue how to type so I pasted it, but it doesn't seem to work

// Set Column 3 to Currency Format 
ws.getColumn(3).numFmt = '�#,##0;[Red]-�#,##0';
like image 446
tumelo Avatar asked Jan 06 '17 17:01

tumelo


People also ask

What is a currency format?

United States (U.S.) currency is formatted with a decimal point (.) as a separator between the dollars and cents. Some countries use a comma (,) instead of a decimal to indicate that separation.

What is Currency format in Excel?

When you apply the Currency format to a number, the currency symbol appears right next to the first digit in the cell. You can specify the number of decimal places that you want to use, whether you want to use a thousands separator, and how you want to display negative numbers.

Is currency an example of a number format in Excel?

In Excel, you can format numbers in cells for things like currency, percentages, decimals, dates, phone numbers, or social security numbers. Select a cell or a cell range. On the Home tab, select Number from the drop-down.


1 Answers

Just took a little bit of tinkering with.

ws.getColumn(3).numFmt = '$#,##0.00;[Red]-$#,##0.00';

The #'s are optional digits. If you don't care about negative numbers being red you can leave it as $#,##0.00

like image 164
tumelo Avatar answered Jan 01 '23 07:01

tumelo