SQL functions in Google Sheets to fetch data from Datasette

AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.

Why it matters

Anyone can now pipe live query results from a Datasette-hosted database straight into Google Sheets without writing an app, cutting manual copy-paste reporting workflows.

Read this as

Simon Willison has published notes and an example sheet showing three ways to pull data from Datasette, a free tool that hosts databases you can query online, into Google Sheets. The simplest uses a built-in spreadsheet function that imports table data automatically. If the API requires a secret access token, a small custom script is needed instead. Data analysts who currently export and paste data by hand can now have live results refresh into their spreadsheets.

Willison documents three integration patterns for pulling live data from a Datasette instance into Google Sheets, with a working example sheet. The trade-off matters: the built-in importdata() function cannot send API tokens, so authenticated APIs require a Google Apps Script. Teams doing internal reporting or dashboards save effort; there is no product to buy, just patterns to copy. It is a low-cost workflow improvement for spreadsheet-centric teams.

Willison describes three approaches: calling importdata() against a Datasette JSON or CSV endpoint, wrapping it in a named function for reuse, and using Google Apps Script with UrlFetchApp when the endpoint requires an API token in an HTTP header, a capability importdata() lacks. A demonstration Google Sheet covering all three methods is linked. No performance figures, authentication details beyond the token limitation, or pagination handling are given.

Read the original

This summary exists to save you time, not to replace the source.

Key terms

Google Sheets Datasette Google Apps Script importdata()

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading