convert-excel-to-json icon indicating copy to clipboard operation
convert-excel-to-json copied to clipboard

Option to transform data during conversion

Open DiegoZoracKy opened this issue 7 years ago • 6 comments

Example:

columnToKey: {
	A: 'id',
	B: 'name',
	C: {
		property: 'phoneNumber',
		transform: (value, row) => value.toString() // 'row' would be the entire row with all its columns (it could be used to concatenate with values from other columns for example).
	}
}

Based on the idea described here:

https://github.com/DiegoZoracKy/convert-excel-to-json/issues/3#issuecomment-319845759

DiegoZoracKy avatar Aug 15 '17 01:08 DiegoZoracKy

Hello, i'm getting this error TypeError: columnData.match is not a function, when i'm using columnToKey can you help me?

Abhay2012 avatar Feb 19 '18 03:02 Abhay2012

Hi @Abhay2012, can you post here to me the snippet of code where you are calling the function? Also, can you open a new issue for us to talk about your case? This one is specific for the feature request described above.

DiegoZoracKy avatar Feb 19 '18 22:02 DiegoZoracKy

One more use case where this feature would be helpful: https://github.com/DiegoZoracKy/convert-excel-to-json/issues/12

DiegoZoracKy avatar Aug 20 '18 13:08 DiegoZoracKy

I got the same error

columnData.match is not a function

thearabbit avatar Aug 21 '18 09:08 thearabbit

Could you explain on doc?

thearabbit avatar Aug 21 '18 09:08 thearabbit

Hi @thearabbit,

Can you post here the config you passed in to this module that resulted in columnData.match is not a function?

DiegoZoracKy avatar Aug 28 '18 00:08 DiegoZoracKy