Skip to content

Google Sheets

github-actions[bot] edited this page Nov 21, 2026 · 1 revision

Generated from the thetowersdk repository. Edits made here are overwritten on the next push — change the source file instead.

Google Sheets

Community workbooks hold things no save file does. @beardedunicorn/thetowersdk/sheets reads and writes them, and handles the parts that mislead:

import { TowerSheets } from '@beardedunicorn/thetowersdk/sheets'

const sheets = new TowerSheets({ transport, spreadsheetId, protectSpreadsheets: [COMMUNITY] })
const grid = await sheets.readGrid('Costs!A1:C50')     // padded to the shape you asked for
const formulas = await sheets.readFormulas('Derived!A1:A200')
if (formulas.likelySpilled) { /* only the anchor carries a formula */ }

Two reads look like data and are not. A spilled cell has no formula of its own, so a formula read of an ARRAYFORMULA range comes back empty and reads as "plain typed values" — the opposite of the truth. And the API truncates trailing empties, so a blank cell and an absent column arrive as the same undefined. Both are reported rather than smoothed over.

Writes to a spreadsheet you name as protected throw rather than skipping, because a silent refusal has your tool report success while the sheet never changed.

There is no googleapis dependency: the package describes the two calls it needs and you supply them, which keeps it browser-safe and leaves your auth library your choice. templates/sheets-client.ts is the adapter, and docs/GOOGLE_SHEETS.md walks through registering a service account and sharing a sheet with it.


Clone this wiki locally