You can use read-excel-file npm.
In that, you can specify JSON Schema to convert XLSX into JSON Format.
const readXlsxFile = require('read-excel-file/node');
const schema = {
'Segment': {
prop: 'Segment',
type: String
},
'Country': {
prop: 'Country',
type: String
},
'Product': {
prop: 'Product',
type: String
}
}
readXlsxFile('sample.xlsx', { schema }).then(({ rows, errors }) => {
console.log(rows);
});