Hello,
if you want to download a file, you should use the Flask routing with one of the functions (send_file or send_from_directory), more information can be found here
here is a simple example :
import dash
import dash_bootstrap_components as dbc
import dash_html_components as html
from dash.dependencies import Input, Output
from flask import Flask,send_from_directory
server = Flask(__name__)
app = dash.Dash(server=server)
# leave it blank if your file is in the root
#otherwise add name of the folder here
FILE_DIRECTORY = ""
app.layout = html.A(html.Button('Download file'), href="Download/File.xlsx")
@server.route("/Download/<path:path>")
def download(path):
return send_from_directory(FILE_DIRECTORY, path, as_attachment=True)
if __name__ == '__main__':
app.run_server(debug=True)
You can also check this thread where send_file is used to do the same