Combobox options from Google Sheets

Tkinter Combobox with data from google sheet
We are collecting data from google sheets and using as options of a Combobox

Tkitner Combobox with options taken from Google sheet using pygsheets
import pygsheets
path='G:\\My drive\\testing\\google-sheet\\creds1.json'
gc=pygsheets.authorize(service_account_file=path)
sh=gc.open('my_gsheets1') 
wk1=sh[0]
#collect data from first column 2nd row to 7th row
l1=wk1.get_values('A2','A7') # create a list using range
#print(*l1) # testing our list 

### Use the list l1 as options of Combobox : Part II #
import tkinter as tk
from tkinter import ttk
my_w = tk.Tk()
my_w.geometry("150x150")  # Size of the window 
my_w.title("www.plus2net.com")  # Adding a title

cb1 = ttk.Combobox(my_w, values=l1,width=7) # Combobox
cb1.grid(row=1,column=1,padx=10,pady=20) # adding to grid

cb1.set('King') # default selected option
my_w.mainloop()  # Keep the window open
Pygsheets and google API authorization Python Tkinter Combobox
Subhendu Mohapatra — author at plus2net
Subhendu Mohapatra

Author

🎥 Join me live on YouTube

Passionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.



Subscribe to our YouTube Channel here



plus2net.com







Python Video Tutorials
Python SQLite Video Tutorials
Python MySQL Video Tutorials
Python Tkinter Video Tutorials
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
©2000-2025   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer