Published on

Python Select SQL from Google Sheets

Authors
python-google-sheet.jpg

Video Tutorial (Thai)

Step1: Install

pip install gsheetsdb

Step2: Set to Viewer mode

  • you need to set your google sheet as Viewer or use my Example data

Step3: Run code in colab

python_gsheets.py
from gsheetsdb import connect
import pandas as pd
conn = connect()

query = """
SELECT * FROM "https://docs.google.com/spreadsheets/d/1GhiXbcAAyLiiCP1ClcAwBILDYNm2TzHJgW7KbjOfEjI/edit#gid=0"
"""

df = pd.read_sql(query, con=conn)

Comment & Discussion Click