I am using the following code to connect to google sheets:
# Set up credentials to access Google Sheets API
scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
creds = ServiceAccountCredentials.from_json_keyfile_name('credentials.json', scope)
client = gspread.authorize(creds)
sheet_name = 'x'
sheet = client.open('y').worksheet(sheet_name)
df = pd.DataFrame(sheet.get_all_records())
But I didn’t understand how to use st.cache_data to update data frequently. The spreadsheet data is updated every other day, I wanted the charts to keep up with those updates. Could anybody help me, please?