Allow users to dowload an Excel in a click

Hi @AnnMarieW,

sorry about the late reply.

I am not sure if I was completely clear. But what I use today is in a python script which I would like to move to Dash. This example creates a workbook an then fill in the data using xlsxwriter.

def performance_excel(df,test_info):
    name = test_info['output_name']
    workbook = xlsxwriter.Workbook('data/reports/{}.xlsx'.format(name)) 
    worksheet = workbook.add_worksheet('data') 
    worksheet_graph = workbook.add_worksheet('graph')

I use different formats

 # Formats used   	
    headline = workbook.add_format({
        'bold': True,
        'font_size': 18,
        'align': 'center',
        'border' : 2 })
    
    bold = workbook.add_format({
        'bold': True })
    
    border = workbook.add_format({
        'border': 2,
        'align': 'center',
        'valign': 'vcenter',
        'text_wrap': True})
    
    bold_large = workbook.add_format({
        'font_size': 14,
        'border': 2,
        'bold': True })

Then I fill out the data

### Data
    step_no = df['StepNo'].unique()
    row_st = 18
    
    for i in reversed(step_no):
        no_of_points = df['StepNo'][df['StepNo']==i].size
        worksheet.write('B{}'.format(row_st), i)
        try:
            q = df['Q [m3/h]'][df['StepNo']==i].values.round(2)
            worksheet.write_column('C{}'.format(row_st), q)
        except:
            pass
        try:
            h = df['H [m]'][df['StepNo']==i].values.round(2)
            worksheet.write_column('D{}'.format(row_st), h)
        except:
            pass
          

Then I make the graphs

# QH chart
    chart1 = workbook.add_chart({'type': 'scatter',
                                 'subtype': 'smooth'}) 
    chart1.add_series({ 
     	'categories': '=data!$C$18:$C${}'.format(row_st-2), 
     	 'values':	 '=data!$D$18:$D${}'.format(row_st-2), 
    	 'line': { 
      			'color': 'red', 
      			'width': 2, 
     			}, 
    })
    chart1.set_title({'name': 'QH Chart'}) 
    chart1.set_x_axis({'name': 'Q [m3/h]',
                       'major_gridlines': {
                           'visible': True,
                           'line':{'width': 1, 'dash_type': 'dash'}
                           }
                       }) 
    chart1.set_y_axis({'name': 'H [m]',
                       'major_gridlines': {
                           'visible': True,
                           'line':{'width': 1, 'dash_type': 'dash'}
                           }
                       })
    chart1.set_legend({'none': True})

And finally I close the workbook

   workbook.close()

What I have just learned is that maybe we can make the report function in Dash and then just use the pd to excel function for those who want the raw data. So right now I am on the lookout for a great report template which has a nice styling. Then I can present it to the managers, and hopefully convince them to go Dash enterprise :slight_smile: