RC RANDOM CHAOS

Pulling Datasette Query Results into Google Sheets via importdata and Apps Script

· via Simon Willison

Original source

SQL functions in Google Sheets to fetch data from Datasette

Simon Willison →

Simon Willison documents three patterns for piping live data from a Datasette instance into Google Sheets. The simplest path is the built-in IMPORTDATA() function, which can hit a Datasette CSV endpoint directly from a cell. Wrapping that call in a Google Sheets named function makes the pattern reusable across a workbook without pasting the full URL each time.

The third approach reaches for Google Apps Script, which is necessary when the Datasette instance requires an API token. IMPORTDATA() cannot set HTTP headers, so token-authenticated requests have to go through UrlFetchApp in Apps Script instead. An accompanying example sheet shows all three methods side by side, making it a useful template for anyone wiring Datasette queries into spreadsheet-based reporting.

Read the full article

Continue reading at Simon Willison →

This is an AI-generated summary. Read the original for the full story.