Type Alias: Cell¶
Cell =
Primitive|Date
Represents a value that can appear in a spreadsheet cell.
Extends Primitive with Date to accommodate Google Apps Script's getValues(),
which returns cells formatted as dates as Date objects rather than strings.
To convert all values to Primitive for uniform representation, use
Utilities.formatDate() (GAS) or date.toISOString() (standard JS).
Example¶
TypeScript
// From Sheet.getValues(), date cells are already Date objects
const cell: Cell = new Date("2024-01-01");
const text: Cell = "Alice";
const num: Cell = 42;
// Convert Date to string if needed
const isoString = (cell as Date).toISOString(); // "2024-01-01T00:00:00.000Z"