Created
January 28, 2023 12:32
-
-
Save blackary/e2870697d93440bbb0c7b3696f354c36 to your computer and use it in GitHub Desktop.
Getting access to a public Google sheet without any authentication setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First pip install 'shillelagh[all]' | |
from shillelagh.backends.apsw.db import connect | |
connection = connect(":memory:") | |
cursor = connection.cursor() | |
query = """ | |
SELECT country, SUM(cnt) | |
FROM "https://docs.google.com/spreadsheets/d/1_rN3lm0R_bU3NemO0s9pbFkY5LQPcuy1pscv8ZXPtg8/edit#gid=0" | |
WHERE cnt > 0 | |
GROUP BY country | |
""" | |
for row in connection.execute(query): | |
print(row) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment