Dash plotly help with callback

hello everyone , i’m a freshperson on application of dash , i want really to create a dropdown that takes two options , when i choose one , python upload that excel file so this is my code could just shox me whey it doesn’t work

-- coding: utf-8 --

“”"
Created on Thu Oct 10 09:32:07 2019

@author: amina
“”"
import pandas as pd
import openpyxl
from openpyxl import load_workbook
import pandas
import dash
from dash.dependencies import Output, Input
import os
import sys
import openpyxl
from openpyxl import load_workbook
#sys.path.insert(0, os.path.realpath(os.path.dirname(file)))
#os.chdir(os.path.realpath(os.path.dirname(file)))

import dash
from dash.dependencies import Output, Input
import dash_core_components as dcc
import dash_html_components as html
external_stylesheets = [‘https://codepen.io/chriddyp/pen/bWLwgP.css’]
app = dash.Dash(name, external_stylesheets=external_stylesheets)

app.layout = html.Div(children=[
html.H1(children=‘Hello Dash’),

html.Div(children='''
    Dash: A web application framework for Python.
'''),
dcc.Dropdown(
        id ='my_dropdown',

    options=[
        
        {'label': 'ARLES', 'value':'ARLES.xlsx'},
        {'label': 'AVIGNON', 'value':'AVIGNON.xlsx'}
        
    ],multi=True,
    value=[]
),

])
@app.callback(
dash.dependencies.Output(‘display_value’, component_property= ‘value’),
[dash.dependencies.Input(‘my_dropdown’, ‘option’)])
def display_value (option):
data=load_workbook(value, keep_vba=True)
return data
if name == ‘main’:
app.run_server(debug=True)

Hi, the property of Dropdown you callback should be listening to is value, as in this example https://dash.plot.ly/dash-core-components/dropdown. Dropdown does not have an option property (it does have an options one, but here it’s the value which you’re changing interactively). Hope this helps.

1 Like

thank you so much @Emmanuelle