I'm having trouble separating the headers of an Excel sheet. The code I have implemented is only working for text format. Could someone please assist me?
const xlsx = require('xlsx');
const workbook = xlsx.readFile('./SMALL.xlsx');
const worksheet = workbook.Sheets[workbook.SheetNames[0]];
const workbookHeaders = xlsx.readFile('./SMALL.xlsx', { sheetRows: 1 });
const columnsArray = xlsx.utils.sheet_to_json(workbookHeaders.Sheets[workbook.SheetNames[0]], { header: 1 })[0];
console.log(columnsArray);
Response
The output in my console should be ['Task', '1/2022', '2/2022'], but instead it's showing [ 'Task', 44562, 44593 ]. Any ideas on how to fix this?