Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

279
Views
ReactJs Download Excel Error : We found problem with content

I have below code to call api which returns bytes for excel.

When I convert bytes to excel online , file looks good.

But , When I call api through react js with below code , it gives me error -

We found a problem with content in <file.xlsx>. Do you want to recover as mych as we can?

 agent.ExcelExport(data,{
responseType:"arraybuffer"
})
.then((res:any)=>{
const url= window.URL.createObjectURL( new Blob([res.data],{type:"application/x-msdownload"}));
const link=document.createElement('a');
link.href=url;
link.setAttribute('download','filename.xlsx');
link.click();
window.URL.revokeObjectURL(url);

I can see , Api getting hit clearly and responding with expected data. While opening file , its giving error.

.NET Core Api is returning -

return File(excelbytes,"application/x-msdownload","filename.xlsx");

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!