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 Export to Word Export to PDF
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-export-database 0.3a1

Simon Willison's Blog

datasette-export-database version 0.3a1 released, providing database export functionality as part of the Datasette ecosystem.

datasette 1.0a27

Simon Willison's Blog

Datasette 1.0a27 released with major security improvements (modern CSRF headers), new RenameTableEvent for plugin compatibility, and various API enhancements including improved upsert handling and database locking fixes.

Introducing ChatGPT for Excel and Google Sheets

YouTube AI Channels

OpenAI released ChatGPT add-ins for Excel and Google Sheets, enabling users to analyze, update, and explain spreadsheets using AI. The add-ins are powered by GPT-5.5 and are now available globally for all plans.

SQLite Query Result Formatter Demo

Simon Willison's Blog

Interactive WebAssembly-based demo for SQLite Query Result Formatter that allows users to format SQL query results in 20+ styles including tables, CSV, JSON, HTML, and Markdown with real-time adjustments.

FACTS: Table Summarization via Offline Template Generation with Agentic Workflows

arXiv cs.CL

FACTS introduces an agentic workflow for query-focused table summarization that generates reusable offline templates combining SQL queries and Jinja2 templates, enabling fast, accurate, and privacy-compliant summarization without exposing sensitive data. The approach outperforms existing baselines by avoiding costly fine-tuning and token-limit issues while maintaining scalability across tables with shared schemas.