Corrupted Excel file getting downloaded through API gateway

I am using a lambda function to generate a excel file. I am accessing this generated excel file in my react frontend via API gateway. However when I am trying to download this file in through my frontend, I can’t seem to open it. It says that “the given file format does not match its extension”. I saw a few related question here in stackoverflow and tried the configuration but I am still not able to resolve this error.

Also my excel file is getting created correctly as just for testing, I tried to save my excel file in my s3 bucket first and download manually from there. I was able to download the correct excel file with expected output in it. However when I send it to the frontend through the API gateway it gets corrupted.

Here is my lambda function code

import json

import io
import base64
import pandas as pd
from openpyxl import Workbook
from openpyxl.worksheet.datavalidation import DataValidation

data = [
    ["HEAD1", "Head2"],
    ["hello", "operating_system"],
    ["durablility", "material"],
    ["longevity", "item_name"],
    
]

def lambda_handler(event, context):
    # i generate my workbook correctly using openpyxl
    wb = Workbook()
    ws = wb.active
    for r in data:
      ws.append(r)
    buffer = io.BytesIO()
    wb.save(buffer)
    excel_final = buffer.getvalue()
    buffer.close()
    return {
        'statusCode': 200,
        'headers': {
        'Access-Control-Allow-Origin': '*',
        },
        'body': base64.b64encode(excel_final),
        'isBase64Encoded': True
    }

Here is how I am fetching it from my frontend , I have tried this multiple options in the request none of them seem to work

const requestOptions = {
    method: 'GET',
    headers: {
       'Accept': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
    }, 
    
  };  

     fetch(url,requestOptions)
     .then(response => {
      if (response.ok) {
        return response.arrayBuffer();
      }
    })
    .then(blob => {
      const file = new File([blob], "demo.xlsx",{type:"application/xml"})
      const link = document.createElement('a')
      const url = URL.createObjectURL(file)

      link.href = url
      link.download = file.name
      document.body.appendChild(link)
      link.click()

Also in my API gateway I have enabled binary media types and set it to application/vnd.openxmlformats-officedocument.spreadsheetml.sheet still no help.

I am unable to understand what is causing my file to get corrupted. Any help will be appreciated.