Problem with decimal point

hello every one i have a bit of a pickle
im importing a exel to knime but it keeps removing the decimal place no matter what i do if the number has a zero at the right it removes it and i cant keep both decimal places, even when i try to make that line column a string it dont work
image
image
in the exel it has the decimal but knime refuses to keep it no matter what, any one know how i can keep the decimal points?
thank you for your time

As far as I’m aware, the Excel Reader Node looks only at the value of each cell. Any formating will be ignored.
66.00 and 66 is the same number, with the only difference being the representation*. You can choose between several different render methods in KNIME tables, but those don’t affect any logic or calculation, it’s just a way of displaying the values. I hope that means for you that everything is fine?
You can change the renderer of a column by right clicking on it, then selecting a different renderer. That setting will not stick though, as it’s just cosmetic. So after each execution, it will be the default renderer again.
If you want to export a table back to excel, you’d probably need to convert them to a formated string first, because the Excel Writer Node can, as far as I know, not do any formating.


*Yes, the extra zeros carry information about the precision of a measurement etc., but that’s beside the point :wink:

2 Likes

the problem with full precision is that i will miss one 0, this document needs to have the exact amount of spaces so if i miss one 0 then instead of being 1 dollar and and 0 cents it will become 0 dollars and 0 cents when i import for the other program, i tried to make it as a string on the excel but Knime still refuses, makes it a double and and removes the 0, how would be a easy way to force it to keep it as string before going in Knime

You can choose to import as string in the advanced tab of the Excel Reader Node. This is better than formating in Excel imho. But, it seems you want to export with a specific format? (#.00 in Excel speak). Or you want to do some manipulation within KNIME?
Then it would be better to do the number to string conversion shortly before writing the file. It can probably be done with a String Manipulation Node, but I’m more of a programmer guy, so I suggest the Java Snippet Node with a simple one liner:

outputString = String.format("%.2f", inputDouble);


excel_reader_format2
excel_reader_format.knwf (13.4 KB)

1 Like

@Bleck maybe you could try and use the:

And try to format the number after you have exported it to excel

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.