Hello,
when I try to upload an Excel file to my dash app through the dcc.Upload component, if the file is not already present in the current working directory, then the system outputs an error message FileNotFoundError: [Errno 2] No such file or directory
My goal here is to allow a user to upload a file and to visualize the graph of that file’s contents on the go.
Can anyone help me out? Thanks!
My code is the following:
app.layout = html.Div(
children=[
html.H2('1. Upload a file', style={'margin': '10px'}),
html.P(instructions_1, style={'margin': '10px'}),
dcc.Upload(
id='upload-data',
children=html.Div([
'Select a .xlsx file',
]),
...
@forecaster.callback(Output('graph', 'figure'),
[Input('upload-data', 'filename')],
events = [Event('update', 'interval')])
def update_graph(file):
if file != None:
with open(file):
df = pd.read_excel(file)
`