2 hours ago · Tech · 0 comments

I've been experimenting with ways to fetch data from Datasette and display it in Google Sheets. I've found two patterns that work so far. The first uses a "named function" but can only fetch from public Datasette instances. The second uses App Script and can fetch from API-key protected instances as well. Using IMPORTDATA() The easiest way to get this up and running doesn't involve any custom sheets functions at all. The IMPORTDATA() default function can fetch any CSV data from a URL and load it into the sheet - and Datasette exports CSV by default. https://latest.datasette.io/fixtures/roadside_attractions.csv - the CSV data for the roadside_attractions table. https://latest.datasette.io/fixtures/-/query.csv?sql=select+pk%2C+name%2C+address%2C+url%2C+latitude%2C+longitude+from+roadside_attractions - a SQL export of a database query, in this case one that returns all rows from that table Either of these URLs can be used in a Google Sheets cell like this:…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.