Class SpreadsheetTheme

  • SpreadsheetTheme allows access and modification of existing spreadsheet themes.

  • You can set a theme on a spreadsheet usingSpreadsheet.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 likegetConcreteColor andgetFontFamily return theme properties, while methods likesetConcreteColor andsetFontFamily modify them and return the theme object for chaining.

  • Using these methods requires specific authorization scopes related to accessing and modifying spreadsheets.

SpreadsheetTheme

Access and modify existing themes. To set a theme on a spreadsheet, useSpreadsheet.setSpreadsheetTheme(theme).

Methods

MethodReturn typeBrief description
getConcreteColor(themeColorType)ColorReturns the concreteColor for a valid theme color type.
getFontFamily()String|nullReturns the font family of the theme, ornull if it's anull theme.
getThemeColors()ThemeColorType[]Returns a list of all possible theme color types for the current theme.
setConcreteColor(themeColorType, color)SpreadsheetThemeSets the concrete color associated with theThemeColorType in this color scheme to thegiven color.
setConcreteColor(themeColorType, red, green, blue)SpreadsheetThemeSets the concrete color associated with theThemeColorType in this color scheme to thegiven color in RGB format.
setFontFamily(fontFamily)SpreadsheetThemeSets 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

NameTypeDescription
themeColorTypeThemeColorTypeTheme 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.currentonly
  • https://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.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getThemeColors()

Returns a list of all possible theme color types for the current theme.

Return

ThemeColorType[] — 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.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setConcreteColor(themeColorType, color)

Sets the concrete color associated with theThemeColorType in this color scheme to thegiven color.

Parameters

NameTypeDescription
themeColorTypeThemeColorTypeThe theme color type.
colorColorThe color.

Return

SpreadsheetTheme — 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.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setConcreteColor(themeColorType, red, green, blue)

Sets the concrete color associated with theThemeColorType in this color scheme to thegiven color in RGB format.

Parameters

NameTypeDescription
themeColorTypeThemeColorTypeThe theme color type.
redIntegerThe value of red channel.
greenIntegerThe value of green channel.
blueIntegerThe value of blue channel.

Return

SpreadsheetTheme — 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.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFontFamily(fontFamily)

Sets the font family for the theme.

Parameters

NameTypeDescription
fontFamilyStringThe new theme font family.

Return

SpreadsheetTheme — 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.currentonly
  • https://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.