I have a dynamic JSON data fro which I am creating a Excel file using jsno2xls library nut here the resulting excel file header are like Year,DOB,Name and Age and I want excel data in this format Name,Age,DOB and Year.Is there any way I can perform this action and get data in desired format.
Below is what I am doing to create Excel sheet.
const parsedData = [{},....,{}];
const xls = json2xls(parsedData);
fs.writeFileSync('datasheet.xlsx', xls, 'binary');
Here in above code parsedData is coming from database which can have any number of fields in JSON object.
But in resulting Excel file I always want Name and Age column at first.