Help › Work in notebooks
Read a Google Sheet into a notebook
Add a cell whose result is a range of a Google Sheet, read each time it runs with a read-only Google sign-in, and join it with query results in the scratch.
Querlyn 0.1.0 is not released yet. This help describes it ahead of release.
A notebook can take a range of a Google Sheet as one of its results: targets, a mapping table, a list someone keeps by hand. The sheet cell's result has a name, and scratch cells, pivot, chart and filter cells and Python cells read it by that name, as they read any other cell's result.
Querlyn only reads the sheet. It never changes it. (To write a result into a sheet after a scheduled run, see Send a notebook's results.)
This has been tried against a stand-in for Google's Sheets API, not yet against Google itself.
Add a sheet
(in the toolbar's Pivot, Chart, Filter, Sheet menu, and a cell's right-click menu) asks for:
- Sheet: the sheet's address as the browser shows it, or its ID;
- Tab: the tab's name, as at the bottom of the sheet;
- Cells: a range of the tab, like
A1:F200orA:F. Leave it empty for the whole tab.
The first row of the range names the columns. The cell is added below the
selected one; its result is named sheet (then sheet_2, …), and
renames it.
(Change… on the
cell) changes what it reads.
Adding a sheet reads nothing. The sheet is read when the cell runs:
,
, a
dashboard's Refresh, and querlyn notebook run
read the sheets of the cells they run first, then run the other cells. A
sheet is read again on every run; its result is never reused in place of
reading it. Opening a notebook reads nothing: the cell shows the rows saved
in the file.
Join it with a query
Name the sheet's result in a scratch cell:
SELECT s.region, s.sold, t.target
FROM sold s
JOIN targets t USING (region)
Here sold is a query cell's result and targets the sheet cell's. Both
are copied into the notebook's in-memory scratch database for the join;
nothing is sent to your database server, and nothing is written to disk.
How the columns are typed
A sheet has no column types, so Querlyn decides carefully, and says what it decided on the cell ("6 rows, 4 columns: category text, target numbers, owner text, agreed dates"):
- A column is text unless every cell that holds something is of one kind.
- Whole numbers and numbers, when every value is a number in the sheet itself. Whole numbers and other numbers together are numbers. A sheet's numbers are floating point; a whole number beyond what a sheet holds exactly is read as a number.
- True or false, when every value is a checkbox or
TRUE/FALSEin the sheet itself. - Dates, only when every value reads
2026-10-11(year, month, day). Dates shown any other way stay text:10/11/2026means two different days in two countries, and Querlyn does not guess. - One cell of another kind makes the whole column text, as the sheet
shows it.
007,1,234and12 kgstay text. - Empty cells are NULL.
- A formula's result is read, never the formula; text that looks like a formula is text, and nothing evaluates it.
To change a type, cast it in the cell that reads the result
(CAST(target AS DECIMAL(12,2))).
Column names come from the first row, made unique; a column without a
name is column_3.
How much is read
One request, at most 1 MB of values, 100,000 rows and 1,000 columns. A larger range is refused with words; nothing is cut silently. Name fewer cells, or keep what the notebook needs on a tab of its own.
Signing in to Google
The sign-in is this computer's. It is never written into the notebook, so a shared notebook names the sheet and each reader uses their own access.
- When the environment variable
GOOGLE_APPLICATION_CREDENTIALSnames a service account's key file, Querlyn signs in with it. Share the sheet with the service account's address as a viewer. - Otherwise Querlyn asks the Google Cloud CLI for its application
default credentials. Sign in once with
gcloud auth application-default loginand include the scopehttps://www.googleapis.com/auth/spreadsheets.readonly.
Querlyn asks for a token that can only read sheets. It is sent to Google's Sheets API and nowhere else, and is in no file, message or log. Signing in with your Google account in the browser is not built.
When Google refuses (no such sheet or tab, no permission, the sign-in not accepted), the cell shows what Google said, and the cells after it do not run on old data.
Help for Querlyn 0.1.0. All help topics