from starlette.responses import FileResponse @app.get("/download/{file_name}") def main(file_name: str): print(file_name) basedir = os.path.abspath(os.path.dirname(__file__)) path = basedir + ‘\\‘ + str(datetime.datetime.now().date()) file_path = path + ‘\\‘ + file_name + ‘.xlsx‘ print(file_path) return FileResponse(file_path)