I want to extract converted json from coverted excel data file but not working,
I want it to be in this form :
[{assignee: "", description: "seriene", duration: "24", floor: "Deluxe", id: 2, image_one: null,…},…]
0
:
{assignee: "", description: "seriene", duration: "24", floor: "Deluxe", id: 2, image_one: null,…}
1
:
{assignee: null, description: "seriene", duration: "24", floor: "Deluxe", id: 3, image_one: null,…}
2
:
{assignee: null, description: "seriene", duration: "24", floor: "Deluxe", id: 5, image_one: null,…}
But shows this:
{Sheet1: [,…]}
Sheet1
:
[,…]
0
:
{First Name: "Samuel", Last Name: "Gyimah", Staff No.: "San50", Phone: 0, Address: "6th avenue tanoso",…}
Account
:
111222554
Address
:
"6th avenue tanoso"
Appointment
:
45364.99990740741
Bank
:
"UBA"
Branch
:
"AAMUSTED"
Email
:
"[email protected]"
First Name
:
"Samuel"
ID No.
:
"GHA7145562"
Joined
:
45365.99990740741
Last Name
:
"Gyimah"
Phone
:
0
Resident
:
"On Campus"
Staff No.
:
"San50"
Subject
:
"Social Studies"
I used this for loop :
onFileChange(ev) {
this.loading.start();
let workBook = null;
let jsonData = null;
const reader = new FileReader();
const file = ev.target.files[0];
reader.onload = (event) => {
const data = reader.result;
workBook = XLSX.read(data, { type: 'binary' });
jsonData = workBook.SheetNames.reduce((initial, name) => {
const sheet = workBook.Sheets[name];
initial[name] = XLSX.utils.sheet_to_json(sheet);
return initial;
}, {});
const dataString = JSON.stringify(jsonData);
for(let i:number =0;i<dataString.length; i++){
console.log(dataString[i]);
}