insertSchema
function insertSchema(
sheet: GoogleAppsScript.Spreadsheet.Sheet,
schema: SheetSchema
): GoogleAppsScript.Spreadsheet.Sheet;
The schema is written into the sheet's developer metadata, so it travels with the sheet — a copy of the spreadsheet carries it, and getSchema finds it again without reading a single cell.
The description is also put into effect: the header row is written and the columns get the formatting and the validation their types imply.
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The sheet to work on. |
|
| The schema: its |
Returns
GoogleAppsScript.Spreadsheet.Sheet — the same sheet.
Throws
Exception | Condition |
|---|---|
| the first argument is not a sheet. |
Examples
Declaring a schema
const sheet = SpreadsheetApp.getActiveSheet();
insertSchema(sheet, {
version: 1,
headerRow: 1,
columns: [
{ name: "id", type: "number" },
{ name: "email", type: "string" }
]
});
See also
Source
23 September 2026
This documentation was generated with AI (Claude) from the library's source code.