Welcome to Streamlit Google Picker
I built a component that lets you pick files/folders directly from Google Drive β with full multi-select, folder selection, and MIME type filtering.
Medium article (setup & code)
GitHub repository
It works just like st.file_uploader
but for Google Drive β feedback and ideas welcome!
Installation
Open a terminal and run:
pip install streamlit-google-picker
Quickstart
For the Google Cloud APIs setup, check the medium article.
For the complete OAuth 2.0 setup (including login and token refresh), see this exemple.
token = st.session_state["token"]["access_token"] # From your OAuth2 flow
CLIENT_ID = os.environ["GOOGLE_CLIENT_ID"]
API_KEY = os.environ["GOOGLE_API_KEY"]
APP_ID = CLIENT_ID.split("-")[0]
# ==== Google Picker Component ====
uploaded_files = google_picker(
label="Pick files from Google Drive",
token=access_token,
apiKey=API_KEY,
appId=APP_ID,
accept_multiple_files=True, # Enable multi-select (like st.file_uploader)
type=["pdf", "png"], # Restrict to pdf, png
allow_folders=True, # Allow folder selection
view_ids=None, # Tabs: DOCS, Spreadsheets, FOLDERS (custom views)
nav_hidden=True, # Show navigation pane
key="google_picker"
)
if uploaded_files:
for f in uploaded_files:
st.write(f"Filename: {f.name}, Size: {f.size_bytes}")
data = f.read()
st.write(f"Bytes: {len(data)}")