# Download different files

**URL:** <https://community.plotly.com/t/download-different-files/55645>\
**Category:** Dash Python\
**Created:** [August 18, 2021, 8:21am UTC](https://community.plotly.com/t/download-different-files/55645 "2021-08-18T08:21:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaronhh](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@aaronhh](https://community.plotly.com/u/aaronhh)\
**Post date:** [August 18, 2021, 8:21am UTC](https://community.plotly.com/t/download-different-files/55645/1 "2021-08-18T08:21:37Z")

</div>

Hi all, I have a requirement, click on different links on the page and download different files. For example, when you click BPM link, download BPM file, and when you click ACN link, download ACN file. What should I do within download\_excel (), the code is as follows. Any help is very appreciated.

```python
import os
import sys
sys.path.append("./apps/")
from flask import send_file
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
from config import TEMPLATE_DIRECTORY
from app import app

layout = html.Div(
    [
        html.A("BPM_Template", href="/BPM/"),
        html.A("ACN_Template", href="/ACN/"),
        html.A("SAP_Template", href="/SAP/"),
    ]
)

@app.server.route("/TimeSheet/")
def download_excel(filename):
    return send_file(filename_or_fp=os.path.join(TEMPLATE_DIRECTORY, filename),
                     mimetype='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
                     attachment_filename=filename,
                     as_attachment=True,
                     cache_timeout=0
                     )

```

---

<div class="post-metadata">

**Author:** ![dash-beginner](https://avatars.discourse-cdn.com/v4/letter/d/d26b3c/32.png) [@dash-beginner](https://community.plotly.com/u/dash-beginner)\
**Post date:** [August 18, 2021, 1:07pm UTC](https://community.plotly.com/t/download-different-files/55645/2 "2021-08-18T13:07:22Z")

</div>

Hey -

I’m not sure if this is exactly the same problem but take a look at this and let me know if it helps at all because this was my solution to a similar problem.

> [@Excel Writer to dcc.Download](https://community.plotly.com/t/excel-writer-to-dcc-download/54132/6):
>
> Hi Eduardo – I think the below code covers the functionality that I needed it to (it might be a bit of over-engineering, so if you have any suggestions on how to keep the functionality while cleaning up the process, I would love to hear it) smiley. I really appreciate your help on this! import tempfile import dash import dash\_core\_components as dcc import dash\_html\_components as html from dash.dependencies import Input, Output, State import pandas as pd import numpy as np app = dash.Dash(\_\_…
