Literals Stay organized with collections Save and categorize content based on your preferences.
A literal represents a constant value of a built-in data type. Some, but not all, data types can be expressed as literals.
String literals
String literals must bequoted, either with single (' ) or double (" ) quotation marks.
Quoted literals:
| Literal | Sample usage | Notes |
|---|---|---|
| Quoted string |
|
|
| Raw string |
|
|
Escape sequences for string literals
The following table lists all valid escape sequences for representing non-alphanumeric characters in string literals. Any sequence not in this table produces an error.
| Escape Sequence | Description |
|---|---|
\a | Bell |
\b | Backspace |
\f | Formfeed |
\n | Newline |
\r | Carriage Return |
\t | Tab |
\v | Vertical Tab |
\\ | Backslash ( \ ) |
\? | Question Mark ( ? ) |
\" | Double Quote ( " ) |
\' | Single Quote ( ' ) |
\\` | Backtick ( \` ) |
\ooo | Octal escape, with exactly 3 digits (in the range 0–7). Decodes to a single Unicode character (in string literals) or byte (in bytes literals). |
\xhh or \Xhh | Hex escape, with exactly 2 hex digits (0–9 or A–F or a–f). Decodes to a single Unicode character (in string literals) or byte (in bytes literals). Examples:
|
\uhhhh | Unicode escape, with lowercase 'u' and exactly 4 hex digits. Valid only in string literals or identifiers. Note that the range D800-DFFF is not allowed, as these are surrogate unicode values. |
\Uhhhhhhhh | Unicode escape, with uppercase 'U' and exactly 8 hex digits. Valid only in string literals or identifiers. The range D800-DFFF is not allowed, as these values are surrogate unicode values. Also, values greater than 10FFFF are not allowed. |
Date literals
To use literal date and time values in a calculated field, you can precede the value with the appropriate marker:
| Literal | Canonical date format | Sample usage |
|---|---|---|
| Date | YYYY-[M]M-[D]D | DATE '2021-4-1' |
| Date and time | YYYY-[M]M-[D]D [[H]H:[M]M:[S]S] | DATETIME '2021-5-29 23:59:59' |
Numeric literals
Enter numeric literals using unquoted integer or floating point values. For example:
| Literal | Examples | Sample usage |
|---|---|---|
| Integer | 1, -1, 0 |
|
| Floating point | 1.23, -1.2345 |
|
Boolean literals
Use the literal valuestrue andfalse when evaluating Boolean expressions. For example:
IF(Boolean field = true, "yes","no")IF(Boolean field = false, "no","yes")IF(Boolean field, "yes","no")IF(notBoolean field, "yes","no")Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.