Class Banding

  • Banding refers to the color patterns applied to rows or columns of a range within a spreadsheet.

  • Each banding is defined by a range and specific colors for its rows, columns, headers, and footers.

  • You can access and modify various color properties of a banding for the first and second alternating rows/columns, as well as header and footer rows/columns.

  • Banding provides methods to copy, remove, and set the range for the banding.

  • Some methods for getting color properties by returning a String color code are deprecated and replaced by methods that return a Color object.

Banding

Access and modify bandings, the color patterns applied to rows or columns of a range. Each banding consists of a range and a set of colors for rows, columns, headers, and footers.

Methods

MethodReturn typeBrief description
copyTo(range) Banding Copies this banding to another range.
getFirstColumnColorObject() Color|nullReturns the first alternating column color in the banding, or null if no color is set.
getFirstRowColorObject() Color|nullReturns the first alternating row color, or null if no color is set.
getFooterColumnColorObject() Color|nullReturns the color of the last column in the banding, or null if no color is set.
getFooterRowColorObject() Color|nullReturns the last row color in the banding, or null if no color is set.
getHeaderColumnColorObject() Color|nullReturns the color of the first column in the banding, or null if no color is set.
getHeaderRowColorObject() Color|nullReturns the color of the header row or null if no color is set.
getRange() Range Returns the range for this banding.
getSecondColumnColorObject() Color|nullReturns the second alternating column color in the banding, or null if no color is set.
getSecondRowColorObject() Color|nullReturns the second alternating row color, or null if no color is set.
remove() voidRemoves this banding.
setFirstColumnColor(color) Banding Sets the first column color that is alternating.
setFirstColumnColorObject(color) Banding Sets the first alternating column color in the banding.
setFirstRowColor(color) Banding Sets the first row color that is alternating.
setFirstRowColorObject(color) Banding Sets the first alternating row color in the banding.
setFooterColumnColor(color) Banding Sets the color of the last column.
setFooterColumnColorObject(color) Banding Sets the color of the last column in the banding.
setFooterRowColor(color) Banding Sets the color of the last row.
setFooterRowColorObject(color) Banding Sets the color of the footer row in the banding.
setHeaderColumnColor(color) Banding Sets the color of the header column.
setHeaderColumnColorObject(color) Banding Sets the color of the header column.
setHeaderRowColor(color) Banding Sets the color of the header row.
setHeaderRowColorObject(color) Banding Sets the color of the header row.
setRange(range) Banding Sets the range for this banding.
setSecondColumnColor(color) Banding Sets the second column color that is alternating.
setSecondColumnColorObject(color) Banding Sets the second alternating column color in the banding.
setSecondRowColor(color) Banding Sets the second row color that is alternating.
setSecondRowColorObject(color) Banding Sets the second alternating color in the banding.

Deprecated methods

MethodReturn typeBrief description
(削除) getFirstColumnColor() (削除ここまで)String|nullReturns the first column color that is alternating, or null if no color is set.
(削除) getFirstRowColor() (削除ここまで)String|nullReturns the first row color that is alternating or null if no color is set.
(削除) getFooterColumnColor() (削除ここまで)String|nullReturns the color of the last column, or null if no color is set.
(削除) getFooterRowColor() (削除ここまで)String|nullReturns the color of the last row, or null if no color is set.
(削除) getHeaderColumnColor() (削除ここまで)String|nullReturns the color of the header column, or null if no color is set.
(削除) getHeaderRowColor() (削除ここまで)String|nullReturns the color of the header row or null if no color is set.
(削除) getSecondColumnColor() (削除ここまで)String|nullReturns the second column color that is alternating, or null if no color is set.
(削除) getSecondRowColor() (削除ここまで)String|nullReturns the second row color that is alternating or null if no color is set.

Detailed documentation

copyTo(range)

Copies this banding to another range.

Parameters

NameTypeDescription
rangeRange The range to copy this banding to.

Return

Banding — The new banding.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFirstColumnColorObject()

Returns the first alternating column color in the banding, or null if no color is set.

Return

Color|null — The first alternating column color in the banding, or null if no color is set.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFirstRowColorObject()

Returns the first alternating row color, or null if no color is set.

Return

Color|null — The first alternating row color in the banding, or null if no color is set.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFooterColumnColorObject()

Returns the color of the last column in the banding, or null if no color is set.

Return

Color|null — The last column color in the banding, or null if no color is set.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFooterRowColorObject()

Returns the last row color in the banding, or null if no color is set.

Return

Color|null — The footer row color in the banding, or null if no color is set.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getHeaderColumnColorObject()

Returns the color of the first column in the banding, or null if no color is set.

Return

Color|null — The first column color in the banding, or null if no color is set.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getHeaderRowColorObject()

Returns the color of the header row or null if no color is set.

Return

Color|null — The color of the header row; returns null if no color is set.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getRange()

Returns the range for this banding.

Return

Range — The range for this banding.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getSecondColumnColorObject()

Returns the second alternating column color in the banding, or null if no color is set.

Return

Color|null — The second alternating column color in the banding, or null if no color is set.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getSecondRowColorObject()

Returns the second alternating row color, or null if no color is set.

Return

Color|null — The second alternating row color in the banding, or null if no color is set.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

remove()

Removes this banding.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFirstColumnColor(color)

Sets the first column color that is alternating.

Parameters

NameTypeDescription
colorStringThe color code in CSS notation (such as '#ffffff' or 'white'), or null to clear the color.

Return

Banding — This banding, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFirstColumnColorObject(color)

Sets the first alternating column color in the banding.

Parameters

NameTypeDescription
colorColor The new first alternating column color in the banding; setting to null clears the color.

Return

Banding — This banding, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFirstRowColor(color)

Sets the first row color that is alternating.

Parameters

NameTypeDescription
colorStringThe color code in CSS notation (such as '#ffffff' or 'white'), or null to clear the color.

Return

Banding — This banding, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFirstRowColorObject(color)

Sets the first alternating row color in the banding.

Parameters

NameTypeDescription
colorColor The new first alternating color in the banding; setting to null clears the color.

Return

Banding — This banding, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFooterColumnColor(color)

Sets the color of the last column.

Parameters

NameTypeDescription
colorStringThe color code in CSS notation (such as '#ffffff' or 'white'), or null to clear the color.

Return

Banding — This banding, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFooterColumnColorObject(color)

Sets the color of the last column in the banding.

Parameters

NameTypeDescription
colorColor The new color of the last column in the banding; setting to null clears the color.

Return

Banding — This banding, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFooterRowColor(color)

Sets the color of the last row.

Parameters

NameTypeDescription
colorStringThe color code in CSS notation (such as '#ffffff' or 'white'), or null to clear the color.

Return

Banding — This banding, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFooterRowColorObject(color)

Sets the color of the footer row in the banding.

Parameters

NameTypeDescription
colorColor The new footer row color; setting to null clears the color.

Return

Banding — This banding, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setHeaderColumnColor(color)

Sets the color of the header column.

Parameters

NameTypeDescription
colorStringThe color code in CSS notation (such as '#ffffff' or 'white'), or null to clear the color.

Return

Banding — This banding, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setHeaderColumnColorObject(color)

Sets the color of the header column.

Parameters

NameTypeDescription
colorColor The new header column color; setting to null clears the color.

Return

Banding — This banding, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setHeaderRowColor(color)

Sets the color of the header row.

Parameters

NameTypeDescription
colorStringThe color code in CSS notation (such as '#ffffff' or 'white'), or null to clear the color.

Return

Banding — This banding, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setHeaderRowColorObject(color)

Sets the color of the header row.

Parameters

NameTypeDescription
colorColor The new header row color; setting to null clears the color.

Return

Banding — This banding, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setRange(range)

Sets the range for this banding.

Parameters

NameTypeDescription
rangeRange The new range for this banding.

Return

Banding — This banding, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setSecondColumnColor(color)

Sets the second column color that is alternating.

Parameters

NameTypeDescription
colorStringThe color code in CSS notation (such as '#ffffff' or 'white'), or null to clear the color.

Return

Banding — This banding, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setSecondColumnColorObject(color)

Sets the second alternating column color in the banding.

Parameters

NameTypeDescription
colorColor The new second alternating column color in the banding; setting to null clears the color.

Return

Banding — This banding, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setSecondRowColor(color)

Sets the second row color that is alternating.

Parameters

NameTypeDescription
colorStringThe color code in CSS notation (such as '#ffffff' or 'white'), or null to clear the color.

Return

Banding — This banding, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setSecondRowColorObject(color)

Sets the second alternating color in the banding.

Parameters

NameTypeDescription
colorColor The new second alternating color in the banding; setting to null clears the color.

Return

Banding — This banding, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

Deprecated methods

(削除) getFirstColumnColor() (削除ここまで)

Deprecated. Replaced by getFirstColumnColorObject()

Returns the first column color that is alternating, or null if no color is set.

Return

String|null — The color code in CSS notation (such as '#ffffff' or 'white'), or null if no color is set.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

(削除) getFirstRowColor() (削除ここまで)

Deprecated. Replaced by getFirstRowColorObject()

Returns the first row color that is alternating or null if no color is set.

Return

String|null — The color code in CSS notation (such as '#ffffff' or 'white'), or null if no color is set.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

(削除) getFooterColumnColor() (削除ここまで)

Deprecated. Replaced by getFooterColumnColorObject()

Returns the color of the last column, or null if no color is set.

Return

String|null — The color code in CSS notation (such as '#ffffff' or 'white'), or null if no color is set.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

(削除) getFooterRowColor() (削除ここまで)

Deprecated. Replaced by getFooterRowColorObject()

Returns the color of the last row, or null if no color is set.

Return

String|null — The color code in CSS notation (such as '#ffffff' or 'white'), or null if no color is set.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

(削除) getHeaderColumnColor() (削除ここまで)

Deprecated. Replaced by getHeaderColumnColorObject()

Returns the color of the header column, or null if no color is set.

Return

String|null — The color code in CSS notation (such as '#ffffff' or 'white'), or null if no color is set.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

(削除) getHeaderRowColor() (削除ここまで)

Deprecated. Replaced by getHeaderRowColorObject()

Returns the color of the header row or null if no color is set.

Return

String|null — The color code in CSS notation (such as '#ffffff' or 'white'), or null if no color is set.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

(削除) getSecondColumnColor() (削除ここまで)

Deprecated. Replaced by getSecondColumnColorObject()

Returns the second column color that is alternating, or null if no color is set.

Return

String|null — The HEX color or null if no color is set.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

(削除) getSecondRowColor() (削除ここまで)

Deprecated. Replaced by getSecondRowColorObject()

Returns the second row color that is alternating or null if no color is set.

Return

String|null — The color code in CSS notation (such as '#ffffff' or 'white'), or null if no color is set.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • 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 the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026年04月13日 UTC.