Does streamlit support real time data?

Hi there,

I am building a dashboard for my clients on streamlit the data is on excel, however when I update the data or add a row, the same does not show on the dashboard.

Can someone please guide me on this.

1 Like

IMHO this is far too little information to be able to help in any way.
Public github repo?

Hi @ira_bajpai. Look, i didn’t understand your doubt clearly but we can try this:

1 - Maybe you should change the title of this topic, doesn’t match with the question you brought.

2 - I don’t know if streamlit supports real time working like this. I also did create a app at streamlit which the user should uploaded their data and then streamlit will be doing the rest he was supposed to do. I don’t know if it is what you want…

1 Like

@ira_bajpai
maybe you can upload excel to a database, and build a circle to check the data, when the data in database changed, the data in web page will change

Hi @Franky1
here’s the repo: GitHub - irab21/Client_Dashboard
I add rows to the excel file and they still don’t show up on the dashboard, or even if I change the status of an entry the dashboard doesn’t get updated.

Hi @feliperoque , I don’t need the user to upload any data, I have the data in an excel sheet that gets updated
I need the dashboard to get updated in accordance with the sheet

I guess your streamlit app is running locally on your users machine? It wouldn’t work this way on a server anyway.

I quickly scrolled through your script.
I think the problem is the @st.cache decorator at your load function. Try without.

3 Likes

yes, I am running it locally for now, can you tell me why wouldn’t it work on a server?

yes, removing the decorator worked for me! Thanks!!

1 Like

If you want to run your app on a server, you have to solve this with the xlsx file differently.
You don’t have access to the user’s file system from the server.
So the user has to upload the xlsx file first.

alright, got it! Thanks Again @Franky1 !

1 Like

This is do-able.
I would first declare components I wish to update using st.empty

An Example:

import streamlit as st

area_1 = st.empty()
area_2 = st.empty()

Then I would create busy loop with your update interval:

while True:  
    data = pd.read_csv("my_data.csv")
    area_1.table(data)
    area_2.line_chart(data) 
    time.sleep(20) #waits 20 seconds before updating again. 

This will update the components declared previously.

In Summary

import streamlit as st
import pandas as pd
import time  

area_1 = st.empty()
area_2 = st.empty()  

while True:  
    data = pd.read_csv("my_data.csv") # load csv
    area_1.table(data)
    area_2.line_chart(data) 
    time.sleep(20) #waits 20 seconds

1 Like

okay, but as @Franky1 said, you will still need to let user upload their data in xlsx or csv at the app. Otherwise you app will not work :nerd_face:

@ira_bajpai We implement all our Streamlit dashboards using Google Sheets and use gspread package to access the data using Google Sheets API: http://dashboards.factly.in/

That way, we could just update the google sheet and the data reflects in real-time.

3 Likes

Hi @deshetti…
Could you please provide some source to know more on how to use google sheets and store data somewhere like on google drive while I deploy my app on streamlit share
Also do you know any source to deploy my app for free and get some storage source also to store some small files there which are uploaded by the user

Regards,
Akash

@Akash743

We are accessing Google Sheets API with gspread package like I mentioned in my previous message. You should be able to get the implementation details from their documentation or through some simple search online for examples.

Streamlit Sharing is free for public repos.

Hope this helps.

-Shashi

Thanks for the reply…
Instead of google sheet, is it possible to keep updating already used normal csv/excel file…
Suppose after deploying my app, i want user to update info in my file…and the next time the file opens i want it to open that updated file only…
So can we do that or have to use google sheet only ?

Regards