getSchema
function getSchema(sheet: GoogleAppsScript.Spreadsheet.Sheet): SheetSchema | null;
A schema describes the columns: their names, their types and the row the names live in. When insertSchema has stored one on the sheet, that is what comes back.
When nothing was stored, the sheet is read and a schema is inferred from the header row and the values below it. The result carries inferred: true in that case, so a caller can tell a description that was declared from one that was guessed.
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The sheet to work on. |
Returns
SheetSchema | null — the schema, or null when the sheet holds nothing to describe.
Throws
Exception | Condition |
|---|---|
| the first argument is not a sheet. |
Examples
Reading a schema
const sheet = SpreadsheetApp.getActiveSheet();
const schema = getSchema(sheet);
schema?.columns.map((column) => column.name);
See also
Source
23 September 2026
This documentation was generated with AI (Claude) from the library's source code.