create excel file from DataFrame and allow download in flask, error: file format/extension not valid

writer = pd.ExcelWriter(df, engine='xlsxwriter')
from flask import Flask, send_file
import pandas as pd
from io import BytesIO

app = Flask(__name__)

@app.route("/download", methods=["GET"])
def download_excel():
    df = pd.DataFrame(
            "Name": ["Tesla", "Tesla", "Toyota", "Ford", "Ford", "Ford"],
            "Type": ["Model X", "Model Y", "Corolla", "Bronco", "Fiesta", "Mustang"],

    output = BytesIO()

    with pd.ExcelWriter(output, engine="xlsxwriter") as writer:
        df.to_excel(writer, sheet_name="Sheet1")

    return send_file(output, attachment_filename="df.xlsx", as_attachment=True)