SQL functions in Google Sheets to fetch data from Datasette

Simon Willison's Blog Tools

Summary

Simon Willison shares techniques for fetching data from Datasette into Google Sheets using SQL functions, including importdata(), named functions, and Google Apps Script methods with API token support.

No content available
Original Article
View Cached Full Text

Cached at: 04/20/26, 08:26 AM

# TIL: SQL functions in Google Sheets to fetch data from Datasette Source: https://simonwillison.net/2026/Apr/20/datasette-sql/ 20th April 2026 TILSQL functions in Google Sheets to fetch data from Datasette (https://til.simonwillison.net/google-sheets/datasette-sql)— I've been experimenting with ways to fetch data from Datasette and display it in Google Sheets. I put together some notes on patterns for fetching data from a Datasette instance directly into Google Sheets — using the `importdata()` function, a "named function" that wraps it, or a Google Apps Script if you need to send an API token in an HTTP header (not supported by `importdata()`). Here's an example sheet (https://docs.google.com/spreadsheets/d/14lRV2-AeBmjI3lJbl2apwfC_ncXqL0uSV68lmtzUI7I/edit?gid=0#gid=0) demonstrating all three methods. None (https://til.simonwillison.net/google-sheets/datasette-sql) Posted 20th April 2026 (https://simonwillison.net/2026/Apr/20/) at 2:33 am

Similar Articles

datasette 1.0a31

Simon Willison's Blog

Datasette 1.0a31 introduces the ability to execute write queries and save stored queries (renamed from canned queries) for users with appropriate permissions, enhancing data editing capabilities.

datasette-charts 0.1a0

Simon Willison's Blog

Simon Willison releases datasette-charts 0.1a0, a Datasette plugin that auto-suggests and renders interactive charts by compiling them into SQL aggregations across the full result set rather than just the current page.

Bring your spreadsheet data to life with Sheets canvas

Google AI Blog

Google introduces Sheets canvas, a Gemini-powered feature that turns spreadsheets into interactive mini-apps like dashboards and seating charts using natural language prompts, available to Google AI Pro/Ultra and Workspace subscribers.