New user with ZERO coding experience. I came across Streamlit via a YouTube video. Nice to e-meet you all. I hope I am posting in the right place.
My requirement: I want to launch a super simple website that simply shows the data from my Excel/Google Sheets file. The audience should be able to sort the data, click on any links, etc. When I update the file, it should reflect on the LIVE site also. How do I go about doing this using Streamlit?
To access data from your Google Sheet and display it in Streamlit, you can use a Python library like gspread.
First, you will need to set up a Google API credential, which you can learn to do through this guide. After setting it up, you should install the gspread library using the following command:
pip install gspread
Once thatโs done, you should create a Python script such as this one
import streamlit as st
import gspread
from oauth2client.service_account import ServiceAccountCredentials
# Set up Google Sheets API credentials
scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/drive']
creds = ServiceAccountCredentials.from_json_keyfile_name('path/to/your-google-credentials.json', scope)
client = gspread.authorize(creds)
# Open the Google Sheets file
spreadsheet = client.open('Your Google Sheets File Name')
# Get the first worksheet
worksheet = spreadsheet.get_worksheet(0)
# Get all values and display them with Streamlit
data = worksheet.get_all_values()
st.write(data)
Obviously, you can do much more with GSpread and Streamlit, and hopefully, this should get you started!