Refresh Pandas DataFrame in dash dropdown

Hi All,

I am busy building a dash webapp that connects to a google sheet, creates a pandas dataframe, and then uses those dataframes in the dcc.dropdown HTML Divs.

Looking at the Live Updates docs: Live Updates | Dash for Python Documentation | Plotly

I see there is a interval variable that can be added to the div:

dcc.Interval(
id=‘interval-component’,
interval=1*1000, # in milliseconds
n_intervals=0
)

Does this mean if I have 4 dcc.Dropdown Divs that I would need to add an interval to every single div or can I somehow add it on app level where my entire dashboard stays updated according to an interval?

Any samples would be greatly appreciated - this is my first web app through dash and I am on a excessive learning curve :slight_smile:

Hi @DrSmith69 and welcome to the community!

No, you don’t need to add separate interval components to each div. You can use the component id interval-component and the component property n_intervals of your interval component in your callbacks.

As you can see in the example on the doc page, the input Input('interval-component', 'n_intervals') is same for both the callbacks.

2 Likes