Ashamed to ask, but for resolving my problem I need to ask. So, I have a problem with reading data from an excel file in my Angular project. The file is located in the assets folder.
I know how to get a file from the folder.
In app.component.ts inside ngOnInit I get a file:
ngOnInit() {
this.http.get('assets/dataTest.xlsx').subscribe((data: any) => {
console.log("get: " + data);
});
}
How I understand inside http.get I need to use code below:
const reader: FileReader = new FileReader();
reader.onload = (e: any) => {
console.log("READ " + e);
};
reader.readAsBinaryString(data);
But it does not work. I get an error:
ERROR TypeError: Failed to execute 'readAsBinaryString' on 'FileReader': parameter 1 is not of type 'Blob'.
Help me please with reading data from an excel file is located in the assets folder.