Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Creating a download all button

I have a date picker ranger which selects 2 dates and returns a table of filenames between the date ranges. Now I want to add a download button to download all the files that have been returned. I am not sure how to add the download all functionality help

def generate_table(dataframe, max_rows):
    return html.Table(
        # Header
        [html.Tr([html.Th(col) for col in dataframe.columns])] +

        # Body
        [html.Tr(html.A([html.Td(dataframe.iloc[i][col]) for col in dataframe.columns], 
                     href=link+dataframe.iloc[i][0])) 
        for i in range(min(len(dataframe), max_rows))] + [html.Button('Download All', id='button-1')]
    )



def convert_to_date(dates):
    dates = dates.replace("-", "")
    dates = datetime.datetime.strptime(dates, '%Y%m%d').date()
    return dates


 external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

 app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
 app.config['suppress_callback_exceptions']=True

 app.layout = html.Div(children=[
   
 html.H4(children='Select a date'),


 dcc.DatePickerRange(
     id='my-date-picker-range',
     min_date_allowed=dt(1995, 1, 1),
     max_date_allowed=dt(2030, 12, 30),
     initial_visible_month=dt.now(),
     with_portal=True,
     display_format='Do MMM, YYYY',
    
 ),



 
 html.Div(id='table-container'),
 html.Ul(id='container')

])


@app.callback(
    dash.dependencies.Output('table-container', 'children'),
    [dash.dependencies.Input('my-date-picker-range', 'start_date'),
     dash.dependencies.Input('my-date-picker-range', 'end_date')])


def files_in_range(start_date, end_date):
     dt = df['Date']
     DT = []
     s = 'advsot_'
     e = '.xlsx'
 
 
     if start_date is not None and end_date is not None:
         start_date = convert_to_date(start_date)
 
         end_date = convert_to_date(end_date)
 
         for i in dt:
            if start_date <= i <= end_date:
                DT.append(s+'{:%Y%m%d}'.format(i)+e)
    
            DT = pd.DataFrame(DT, columns = ['Filename'])
     
            return generate_table(DT, max_rows)
 



if __name__ == '__main__':
    app.run_server(debug=True)