Working on a simple project…Need a simple web page to display a couple sheets from an excel workbook. However, I need the webpage to update when I change data in the Excel file and save it. I know I need to “re-read” the excel file to do this, but also need some sort of auto updater. Having probs even after trying to follow many tutorials and other forum entrys. New programmer, go easy.
Here is what I have so far. This works to spin up the web server and display one sheet.
Needed:
- Display multiple sheets with headers
- Auto update web when excel file is updated and saved.
import dash
import dash_core_components as dcc
from dash.dependencies import Input, Output, Event
import dash_table
import pandas as pd
df = pd.read_excel(’~/Documents/projects/data_test.xlsx’)
app = dash.Dash(name)
app.layout = dash_table.DataTable(
id=‘table’,
columns=[{“name”: i, “id”: i} for i in df.columns],
data=df.to_dict(“rows”)
)
if name == ‘main’:
app.run_server(debug=True)