Numeric type recognition on paste from excel

Tags: #<Tag:0x00007f0b091a6bf0>

Hi. I’ve got an issue with numeric data recognition.

I work with various ‘numeric’ cell formats in excel, like:
image

and:
image.

So, when i try to paste the first one, it appears to be a float:
image

The second one does not change cell content at all.

Is there any way to change this behavior, apart from parsing the incoming data manually with beforePaste hook? Maybe I’m missing something?

Also, is there any easy way to use spaces as a thousands-divider, like here:
image ?
Got no luck with finding something similar in Numbro docs.

Or custom renderer is the only option?

Current configuration:

type: “numeric”,
numericFormat: {
pattern: “0[.]00”
},

Current package version: 6.2.2

Hi @ivan.tselobanov

correct me if I’m wrong - you’d like to keep floats as floats and integers and integers and at the same time keep the numeric validation working.

Yes, that’s correct. I just want to add support for a couple of new numeric formats from excel for a certain numeric-typed cells, also I want to render it with space as thousand-divider.
I actually doubt, that there’ll be any float values pasted, so we can get rid of them if it will help us with getting ‘prettier’ solution :slight_smile:

So, any of the below value pasted:
1350015, 1,350,015, 1 350 015
should be rendered as 1 350 015

the best approach would be to use a custom renderer. It would be able to cover all those goals.

Here https://jsfiddle.net/AMBudnik/xodc2et7/ I have a demo on how to attach rounding to 2 decimal places for floats while keeping integers as they are.
I do not have a demo for adding spaces, but there are a couple of approaches to achieve it. You can use https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split and then join for example.

Yes, that’ll do. Thanks for the reply!