You can query any public Google Sheet or CSV on the internet on the fly with the following syntax.
Get the Sheet ID from the URL
<aside> 💡 The spreadsheet needs to be public (i.e. “Anyone on the internet with this link can view”). Click “Share” in the top right to change this setting on your Sheet.
Replace the ID (
1XGCy0tY...) in the snippet below
CSVWithNames if your sheet has headers or
CSV if it doesn’t
We suggest using CTE’s if you plan to join the data
It’s also a good idea to specify the range (e.g.
with sheet as ( select * from url('<https://docs.google.com/spreadsheets/d/1XGCy0tYU5YcEouO09_ErZIyqjA-VJ4pidLZmMmJkEdk/gviz/tq?tqx=out:csv&sheet=Sheet1&range=A:C>', CSVWithNames) ) select * from sheet
with hn as ( select * from url('<https://storage.googleapis.com/luabase-public/hn.csv>', CSVWithNames) ) select * from hn limit 20