When I receive an excel file from the backend as a byte array, my goal is to convert it into a blob and then save it as a file. Below is the code snippet that demonstrates how I achieve this:
this.getFile().subscribe((response) => {
const byteArray = new Uint8Array(atob(response.data).split('').map(char => char.charCodeAt(0));
this.pdfResult = new Blob([byteArray], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});
let file = new File([this.pdfResult], "sample.xlsx");
});