Google is committed to advancing racial equity for Black communities. See how.

Class Banding

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)BandingCopies this banding to another range.
getFirstColumnColor()StringReturns the first column color that is alternating, or null if no color is set.
getFirstColumnColorObject()ColorReturns the first alternating column color in the banding, or null if no color is set.
getFirstRowColor()StringReturns the first row color that is alternating or null if no color is set.
getFirstRowColorObject()ColorReturns the first alternating row color, or null if no color is set.
getFooterColumnColor()StringReturns the color of the last column, or null if no color is set.
getFooterColumnColorObject()ColorReturns the color of the last column in the banding, or null if no color is set.
getFooterRowColor()StringReturns the color of the last row, or null if no color is set.
getFooterRowColorObject()ColorReturns the last row color in the banding, or null if no color is set.
getHeaderColumnColor()StringReturns the color of the header column, or null if no color is set.
getHeaderColumnColorObject()ColorReturns the color of the first column in the banding, or null if no color is set.
getHeaderRowColor()StringReturns the color of the header row or null if no color is set.
getHeaderRowColorObject()ColorReturns the color of the header row or null if no color is set.
getRange()RangeReturns the range for this banding.
getSecondColumnColor()StringReturns the second column color that is alternating, or null if no color is set.
getSecondColumnColorObject()ColorReturns the second alternating column color in the banding, or null if no color is set.
getSecondRowColor()StringReturns the second row color that is alternating or null if no color is set.
getSecondRowColorObject()ColorReturns the second alternating row color, or null if no color is set.
remove()voidRemoves this banding.
setFirstColumnColor(color)BandingSets the first column color that is alternating.
setFirstColumnColorObject(color)BandingSets the first alternating column color in the banding.
setFirstRowColor(color)BandingSets the first row color that is alternating.
setFirstRowColorObject(color)BandingSets the first alternating row color in the banding.
setFooterColumnColor(color)BandingSets the color of the last column.
setFooterColumnColorObject(color)BandingSets the color of the last column in the banding.
setFooterRowColor(color)BandingSets the color of the last row.
setFooterRowColorObject(color)BandingSets the color of the footer row in the banding.
setHeaderColumnColor(color)BandingSets the color of the header column.
setHeaderColumnColorObject(color)BandingSets the color of the header column.
setHeaderRowColor(color)BandingSets the color of the header row.
setHeaderRowColorObject(color)BandingSets the color of the header row.
setRange(range)BandingSets the range for this banding.
setSecondColumnColor(color)BandingSets the second column color that is alternating.
setSecondColumnColorObject(color)BandingSets the second alternating column color in the banding.
setSecondRowColor(color)BandingSets the second row color that is alternating.
setSecondRowColorObject(color)BandingSets the second alternating color in the banding.

Detailed documentation

copyTo(range)

Copies this banding to another range.

Parameters

NameTypeDescription
rangeRangeThe 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

getFirstColumnColor()

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

Return

String — 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

getFirstColumnColorObject()

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

Return

Color — 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

getFirstRowColor()

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

Return

String — 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

getFirstRowColorObject()

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

Return

Color — 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

getFooterColumnColor()

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

Return

String — 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

getFooterColumnColorObject()

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

Return

Color — 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

getFooterRowColor()

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

Return

String — 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

getFooterRowColorObject()

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

Return

Color — 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

getHeaderColumnColor()

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

Return

String — 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

getHeaderColumnColorObject()

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

Return

Color — 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

getHeaderRowColor()

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

Return

String — 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

getHeaderRowColorObject()

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

Return

Color — 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

getSecondColumnColor()

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

Return

String — 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

getSecondColumnColorObject()

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

Return

Color — 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

getSecondRowColor()

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

Return

String — 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

getSecondRowColorObject()

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

Return

Color — 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
colorColorThe 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
colorColorThe 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
colorColorThe 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
colorColorThe 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
colorColorThe 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
colorColorThe 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
rangeRangeThe 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
colorColorThe 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
colorColorThe 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