Error on GSheetsConnection modules

I am getting error messages on google sheet connections (from streamlit_gsheets import GSheetsConnection) when i use streamlit cloud. Cant import modules of gsheet connections. Codes are working on local just fine. Here are my requirements and error message below .(i tried 1.37 , doesnt work either) Could you please help me i cant find any solution.

On my machine I’m running python 3.12

<requirements.txt>

streamlit>=1.28
matplotlib>=3.8.4
streamlit-extras
streamlit-image-comparison
st-gsheets-connection
pandas>=1.5.3
numpy==1.26.4
folium>=0.17.0
streamlit_folium>=0.21.0


[14:35:00] 🐍 Python dependencies were installed from /mount/src/yazgansmart/requirements.txt using uv.
Check if streamlit is installed
Streamlit is already installed
[14:35:02] πŸ“¦ Processed dependencies!



────────────────────── Traceback (most recent call last) ───────────────────────
  /home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptru  
  nner/exec_code.py:85 in exec_func_with_error_handling                         
                                                                                
  /home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptru  
  nner/script_runner.py:576 in code_to_exec                                     
                                                                                
  /mount/src/yazgansmart/pages/3_Yazgan_Database_Bot.py:4 in <module>           
                                                                                
      1 import streamlit as st                                                  
      2 import pandas as pd                                                     
      3 from difflib import get_close_matches                                   
  ❱   4 from streamlit_gsheets import GSheetsConnection                         
      5 import validators                                                       
      6                                                                         
      7 # Streamlit app title and introduction                                  
                                                                                
  /home/adminuser/venv/lib/python3.11/site-packages/streamlit_gsheets/__init__  
  .py:15 in <module>                                                            
                                                                                
    12 # See the License for the specific language governing permissions and    
    13 # limitations under the License.                                         
    14                                                                          
  ❱ 15 from streamlit_gsheets.gsheets_connection import GSheetsConnection  # n  
    16                                                                          
                                                                                
  /home/adminuser/venv/lib/python3.11/site-packages/streamlit_gsheets/gsheets_  
  connection.py:37 in <module>                                                  
                                                                                
     34 from sql_metadata import Parser                                         
     35 from streamlit.connections import ExperimentalBaseConnection            
     36 from streamlit.runtime.caching import cache_data                        
  ❱  37 from streamlit.type_util import convert_anything_to_df, is_dataframe_c  
     38 from validators.url import url as validate_url                          
     39 from validators.utils import ValidationError                            
     40                                                                         
────────────────────────────────────────────────────────────────────────────────
ImportError: cannot import name 'convert_anything_to_df' from 
'streamlit.type_util' 
(/home/adminuser/venv/lib/python3.11/site-packages/streamlit/type_util.py)
[14:43:19] πŸ™ Pulling code changes from Github...
[14:43:20] πŸ“¦ Processing dependencies...

Hey @CemB - see responses in google sheets - ImportError: cannot import name 'convert_anything_to_df' from 'streamlit.type_util' - Stack Overflow, and Error with version 1.37.0. Have you tried with a previous version of Streamlit?

1 Like

Hey @Manuel3 , when i fixed streamlit to 1.28 (streamlit == 1.28) it has worked. But it should be working in 1.37. I following below issue on below link. I think they are making revisions.

Thanks for feedback anyways

Thanks! I agree that should be fixed.

Hi, the issue has been closed in the github repo, but I am still facing this problem. What am I missing? May it be marked as closed but still not fixed? I apologize if I am not aware of any obviousness

Which version are you using?

Cloud streamlit 1.36. locally 1.37. neither work

Which version of st-gsheets-connection.

st-gsheets-connection-0.0.4 locally, in cloud is imported in the requirements.txt by git+repo URL (I guess it should be the latest, to my knowledge, the same as above). Everything used to work until end of July

That version cannot have the fix because it is more than half a year older.

Thanks. Please kindly explain how to import v0.1.0 into streamlit cloud, as it seems the git+repo URL method is not importing the newest. Thanks for your help

Just make sure you have st-gsheets-connection in your requirements file. If the package is not upgraded you may need to reboot or redeploy the application.

1 Like

This has fixed the app, many thanks for your kind help.