
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
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.