I pass Excel file to json and I need to put the information from the object in one json file placed in assets folder. I try using FILE component but I can not find the solution any Help please. The ExcelData need to write to files """
import { Component, OnInit } from '@angular/core';
import * as XLSX from 'xlsx'
import { HttpClient, HttpHeaders } from '@angular/common/http';
export class ExcelPage implements OnInit {
ExcelData: any;
files= this.httpClient.get('../../assets/json/data.json')
constructor( private httpClient: HttpClient) { }
ngOnInit() {
}
ReadExcel(event:any){
let file= event.target.files[0];
let fileReader = new FileReader();
fileReader.readAsBinaryString(file);
fileReader.onload =(e)=>{
var wb = XLSX.read(fileReader.result,{type:'binary'});
var sheetNames = wb.SheetNames;
this.ExcelData = XLSX.utils.sheet_to_json(wb.Sheets[sheetNames[0]])
// console.log(this.ExcelData)
JSON.stringify(this.ExcelData)
XLSX.writeFile(this.ExcelData, "../../assets/json/data.json")
"""