Formatting a column as a currency - exceljs

I am using the exceljs library in nodejs to read in an xlsx file, update some fields, apply some formatting, and save as a new file.
I am trying to apply a currency format to a column
worksheet1.getColumn(6).numFmt = '#,##0.00 [$€-1];[Red]-#,##0.00 [$€-1]';
This applies the format to column 6 as expected, but also to ALL other blank cells in the document.
This is surely not correct!
Any ideas?
Thanks
Dave

Just tried to use the same with latest exceljs version in my angular project and it works as expected. Blank cells remain as it is.
Are you sure you are not adding blank strings or some whitespace data into all excels by mistake?
Or you meant something else by "ALL other blank cells.."?

Related

Conditional formatting that used to work in Google Sheets, not anymore

A few months back I used to use a conditional formatting to highlight duplicates in a column. The formula I used is: =COUNTIF(A:A, A1)>1.
It doesn't seem to be working anymore. When I try to add this as the custom formula, I get an error message: Invalid formula. I even opened a few older sheets to check, it still works on them. Any tips?
General Grievance's comment:
Change the , to a ;. I think your sheet might be in a different locale.

Google Sheets - Parse Number / Currency

I have a spreadsheet in Google Sheets. I have a column with a set of strings e.g. '£3.36'. Now I wish for these to be treated as a number/currency and not as a string, as I am unable to mathematically manipulate them otherwise.
I have tried removing the £ by using =Right() and =LEN(), but unfortunately, sheets still considers them to be a string.
I have tried changing the format of the cell and selecting currency, but this does not work either.
I have also tried =TO_PURE_NUMBER(), but this didn't work for me either.
Has anybody got any suggestions?
All help is appreciated.
Scratch that. =right(x,len(x)-1) does actually work!

Date column not ordering correctly

I have a sheet that i use to paste some information, the issue is that since i am pasting it and since the order from where i copy is in reverse (the newest from top) when i paste it i need to order it.
For some reason that i am not understanding it will not order it automatically, any idea why ?
I have already change the format of the column to the correct one, but even with that is not ordering correctly.
Any idea why and how to fix it with out messing with the sheet data... ?
This is an example of the sheet: sheet example here
Why
The datatype of the values is plaintext instead of date and Google Sheets is not able to automatically interpret the values as dates due to the comma.
How to fix
To fix this you could...
Before copying and pasting
When generating the date values, avoid to include the comma
After copying and pasting
Choose one of the following:
Use find and replace to remove the comma.
Use an auxiliary column with a formula like this:
=ArrayFormula(datevalue(substitute(A:A;",";""))+TIMEVALUE(substitute(A:A;",";"")))
Use Google Apps Script.

Getting inconsistent tab delimiter width when pasting from Google docs spreadsheet

I am trying to create a gadget for some people, where all they need to do is really copy the contents of a spreadsheet, then paste it in a textbox, which will in turn create a nice table for them to embed in their articles.
I managed to do everything, however Google docs, when copying and pasting data in a text editor, seems to get the size (width) of the tab delimiter wrong between values. So, instead of getting 4 spaces that is the default, i am getting 2 in some cases and so far i managed to find out that the reason is that some of the cells contain strings with spaces. For some reason, this seems to confuse Google docs, thus supplying wrong spacings, which in turn, ruin my script.
I know i can use comma separated values here, but the issue is we are trying to give people the ability to simply copy and paste. Look at the example output below:
School Name Location Type No. eligible pupils
In this example, School Name is one cell, Location is another, Type is another and No. eligible pupils is the last one. It is clear that the first cell does not have the necessary space on the right.
Any ideas? I thought about converting all blank spaces that take more than 1 space to commas, but this might lead to a situation users might actually use 2... which would not work again.
For some reason, it was the code editor that was actually not showing the tabs right. Using a regexp and another code editor (vim) showed that all of them were actual tabs. :)

RDLC report dynamic columns based on code

I have an MVC application which displays reports based on the report viewer.
Currently, the report has 4 columns and the requirement is to show columns based on the parameters selected.
I had achieved the solution by using sending parameters to the rdlc file and hiding the columns.
But now the problem which I am having is, when the report is exported as excel the last hidden column is showing as an empty column and this is an issue when printing the report from excel.
I would like to know if there is anything that can be done through code so that the column is not generated at all instead of hiding it. had done a lot of research but didnt find any solution. Can anyone please help me... Thanks!!!
One option would be to update the column's cell expressions to not return anything unless the parameter is set to show that column:
=iif(Parameters!HideColumnValue,Nothing,Fields.YourFieldName.Value)
If your column has background or line formatting that needs to not show when the column his hidden, you can set that as well:
Background Color:
=iif(Parameters!HideColumnValue,"White","Gainsboro")
Lines:
=iif(Parameters!HideColumnValue,"None","Solid")

Resources