I have some trouble on on converting my code to .json file.
document.getElementById('button').addEventListener("click", () => {
XLSX.utils.json_to_sheet(data, 'out.xlsx');
if(selectedFile){
let fileReader = new FileReader();
fileReader.readAsBinaryString(selectedFile);
fileReader.onload = (event)=>{
let data = event.target.result;
let workbook = XLSX.read(data,{type:"binary"});
console.log(workbook);
workbook.SheetNames.forEach(sheet => {
let rowObject = XLSX.utils.sheet_to_row_object_array(workbook.Sheets[sheet]);
console.log(rowObject);
document.getElementById("jsondata").innerHTML = JSON.stringify(rowObject,undefined,4)
});
}
}
});
Also I need to read xlsx file per row and convert it as a .json file
Thanks for the help!