Class SpreadsheetTheme Stay organized with collections Save and categorize content based on your preferences.
Page Summary
SpreadsheetTheme allows access and modification of existing spreadsheet themes.
You can set a theme on a spreadsheet using
Spreadsheet.setSpreadsheetTheme(theme).Methods are available to get and set concrete colors for theme color types and to get and set the font family of a theme.
Methods like
getConcreteColorandgetFontFamilyreturn theme properties, while methods likesetConcreteColorandsetFontFamilymodify them and return the theme object for chaining.Using these methods requires specific authorization scopes related to accessing and modifying spreadsheets.
Access and modify existing themes. To set a theme on a spreadsheet, useSpreadsheet.setSpreadsheetTheme(theme).
Methods
| Method | Return type | Brief description |
|---|---|---|
get | Color | Returns the concreteColor for a valid theme color type. |
get | String|null | Returns the font family of the theme, ornull if it's anull theme. |
get | Theme | Returns a list of all possible theme color types for the current theme. |
set | Spreadsheet | Sets the concrete color associated with theTheme in this color scheme to thegiven color. |
set | Spreadsheet | Sets the concrete color associated with theTheme in this color scheme to thegiven color in RGB format. |
set | Spreadsheet | Sets the font family for the theme. |
Detailed documentation
getConcreteColor(themeColorType)
Returns the concreteColor for a valid theme color type. Throws exception if the themecolor type is not set in the current theme.
Parameters
| Name | Type | Description |
|---|---|---|
theme | Theme | Theme color type. |
Return
Color — Concrete color.
Authorization
Scripts that use this method require authorization with one or more of the followingscopes:
https://www.googleapis.com/auth/spreadsheets.currentonlyhttps://www.googleapis.com/auth/spreadsheets
getFontFamily()
Returns the font family of the theme, ornull if it's anull theme.
Return
String|null — The theme font family.
Authorization
Scripts that use this method require authorization with one or more of the followingscopes:
https://www.googleapis.com/auth/spreadsheets.currentonlyhttps://www.googleapis.com/auth/spreadsheets
getThemeColors()
Returns a list of all possible theme color types for the current theme.
Return
Theme — A list of theme colors.
Authorization
Scripts that use this method require authorization with one or more of the followingscopes:
https://www.googleapis.com/auth/spreadsheets.currentonlyhttps://www.googleapis.com/auth/spreadsheets
setConcreteColor(themeColorType, color)
Sets the concrete color associated with theTheme in this color scheme to thegiven color.
Parameters
| Name | Type | Description |
|---|---|---|
theme | Theme | The theme color type. |
color | Color | The color. |
Return
Spreadsheet — The theme, for chaining.
Authorization
Scripts that use this method require authorization with one or more of the followingscopes:
https://www.googleapis.com/auth/spreadsheets.currentonlyhttps://www.googleapis.com/auth/spreadsheets
setConcreteColor(themeColorType, red, green, blue)
Sets the concrete color associated with theTheme in this color scheme to thegiven color in RGB format.
Parameters
| Name | Type | Description |
|---|---|---|
theme | Theme | The theme color type. |
red | Integer | The value of red channel. |
green | Integer | The value of green channel. |
blue | Integer | The value of blue channel. |
Return
Spreadsheet — The theme, for chaining.
Authorization
Scripts that use this method require authorization with one or more of the followingscopes:
https://www.googleapis.com/auth/spreadsheets.currentonlyhttps://www.googleapis.com/auth/spreadsheets
setFontFamily(fontFamily)
Sets the font family for the theme.
Parameters
| Name | Type | Description |
|---|---|---|
font | String | The new theme font family. |
Return
Spreadsheet — This theme, for chaining.
Authorization
Scripts that use this method require authorization with one or more of the followingscopes:
https://www.googleapis.com/auth/spreadsheets.currentonlyhttps://www.googleapis.com/auth/spreadsheets
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 2025-12-11 UTC.