I tried with the documentation gsheetsdb but it gave me issues related to updating the values. That's why I explored gspread library instead and worked for me and its easier than the one in the documentation. (personal opinion)
The json file in the code can be obtained the same way it is given in the documentation.
import gspread
scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
#the json file should be put in the same location as the python file or give the entire path.
creds = ServiceAccountCredentials.from_json_keyfile_name('testingdb-b6d4d-d0a2646c069a.json', scope)
client = gspread.authorize(creds)
#Create one workbook name it 'TestSheet' and at the bottom rename Sheet1 as 'names'
sh = client.open('TestSheet').worksheet('names')
#Create a list the way you want and add the data to excel worksheet,
#just use the append_row function of the sh object created.
#To read all the data just use the read_all_values() function and you get a list of lists.
row = ["Jason","22","Photography"]
sh.append_row(row)
Check documentation here to get the json file: streamlit docs
Note: In the JSON file, there will be a service account email id. You need to copy that and put it in the Excel sheet Share option. Click on Share and then add a service account email shown below
