Hello,
I followed the instructions for Google Sheets Private and gsheets-connection and got the error below. I also put the name of the tab in the worksheet entry just fine, I don’t know why.
import streamlit as st
import pandas as pd
from streamlit_gsheets import GSheetsConnection
st.title("Student Answer Submission Form")
st.header("Submit descriptive answers to 6 questions")
conn = st.connection("gsheets", type=GSheetsConnection)
existing_data = conn.read(worksheet="Feedback1", usecols=list(range(6)), ttl=5)
existing_data = existing_data.dropna(how="all")
with st.form(key="Feedback_form"):
student_id = st.text_input("Enter your student ID*", placeholder="e.g., 1st grade, class 1, number 5 -> 10105, 1st grade, class 1, number 30 -> 10130)")
answer1 = st.text_area("1. ~~*")
answer2 = st.text_area("2. ~~*")
answer3 = st.text_area("3. ~~*")
answer4 = st.text_area("4. ~~*")
answer5 = st.text_area("5. ~~*")
answer6 = st.text_area("6. ~~*")
st.markdown("**required**")
submit_button = st.form_submit_button(label='Submit')
if submit_button and student_id and answer1 and answer2 and answer3 and answer4 and answer5 and answer6:
st.write("Submitted successfully :)")
Feedback_form = pd.DataFrame(
[
{
"student_id": student_id,
"number1": answer1,
"number2": answer2,
"number3": answer3,
"number4": answer4,
"number5": answer5,
"number6": answer6
}
]
)
# Add new data to existing data
updated_column = pd.concat([existing_data, Feedback_form], ignore_index=True)
# Update Google Sheets
conn.update(worksheet="Feedback1", data=updated_column)