Class Banding Stay organized with collections Save and categorize content based on your preferences.
Page Summary
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.
Access and modify bandings, the color patterns applied to rows or columns of a range. Eachbanding consists of a range and a set of colors for rows, columns, headers, and footers.
Methods
| Method | Return type | Brief description |
|---|---|---|
copy | Banding | Copies this banding to another range. |
get | Color|null | Returns the first alternating column color in the banding, ornull if no color is set. |
get | Color|null | Returns the first alternating row color, ornull if no color is set. |
get | Color|null | Returns the color of the last column in the banding, ornull if no color is set. |
get | Color|null | Returns the last row color in the banding, ornull if no color is set. |
get | Color|null | Returns the color of the first column in the banding, ornull if no color is set. |
get | Color|null | Returns the color of the header row ornull if no color is set. |
get | Range | Returns the range for this banding. |
get | Color|null | Returns the second alternating column color in the banding, ornull if no color is set. |
get | Color|null | Returns the second alternating row color, ornull if no color is set. |
remove() | void | Removes this banding. |
set | Banding | Sets the first column color that is alternating. |
set | Banding | Sets the first alternating column color in the banding. |
set | Banding | Sets the first row color that is alternating. |
set | Banding | Sets the first alternating row color in the banding. |
set | Banding | Sets the color of the last column. |
set | Banding | Sets the color of the last column in the banding. |
set | Banding | Sets the color of the last row. |
set | Banding | Sets the color of the footer row in the banding. |
set | Banding | Sets the color of the header column. |
set | Banding | Sets the color of the header column. |
set | Banding | Sets the color of the header row. |
set | Banding | Sets the color of the header row. |
set | Banding | Sets the range for this banding. |
set | Banding | Sets the second column color that is alternating. |
set | Banding | Sets the second alternating column color in the banding. |
set | Banding | Sets the second row color that is alternating. |
set | Banding | Sets the second alternating color in the banding. |
Deprecated methods
| Method | Return type | Brief description |
|---|---|---|
| String|null | Returns the first column color that is alternating, ornull if no color is set. |
| String|null | Returns the first row color that is alternating ornull if no color is set. |
| String|null | Returns the color of the last column, ornull if no color is set. |
| String|null | Returns the color of the last row, ornull if no color is set. |
| String|null | Returns the color of the header column, ornull if no color is set. |
| String|null | Returns the color of the header row ornull if no color is set. |
| String|null | Returns the second column color that is alternating, ornull if no color is set. |
| String|null | Returns the second row color that is alternating ornull if no color is set. |
Detailed documentation
copyTo(range)
Copies this banding to another range.
Parameters
| Name | Type | Description |
|---|---|---|
range | Range | 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 followingscopes:
https://www.googleapis.com/auth/spreadsheets.currentonlyhttps://www.googleapis.com/auth/spreadsheets
getFirstColumnColorObject()
Returns the first alternating column color in the banding, ornull if no color is set.
Return
Color|null — The first alternating column color in the banding, ornull if no color is set.
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
getFirstRowColorObject()
Returns the first alternating row color, ornull if no color is set.
Return
Color|null — The first alternating row color in the banding, ornull if no color is set.
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
getFooterColumnColorObject()
Returns the color of the last column in the banding, ornull if no color is set.
Return
Color|null — The last column color in the banding, ornull if no color is set.
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
getFooterRowColorObject()
Returns the last row color in the banding, ornull if no color is set.
Return
Color|null — The footer row color in the banding, ornull if no color is set.
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
getHeaderColumnColorObject()
Returns the color of the first column in the banding, ornull if no color is set.
Return
Color|null — The first column color in the banding, ornull if no color is set.
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
getHeaderRowColorObject()
Returns the color of the header row ornull if no color is set.
Return
Color|null — The color of the header row; returnsnull if no color is set.
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
getRange()
getSecondColumnColorObject()
Returns the second alternating column color in the banding, ornull if no color is set.
Return
Color|null — The second alternating column color in the banding, ornull if no color is set.
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
getSecondRowColorObject()
Returns the second alternating row color, ornull if no color is set.
Return
Color|null — The second alternating row color in the banding, ornull if no color is set.
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
remove()
Removes this banding.
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
setFirstColumnColor(color)
Sets the first column color that is alternating.
Parameters
| Name | Type | Description |
|---|---|---|
color | String | The color code in CSS notation (such as'#ffffff' or'white'), ornull to clear the color. |
Return
Banding — This banding, 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
setFirstColumnColorObject(color)
Sets the first alternating column color in the banding.
Parameters
| Name | Type | Description |
|---|---|---|
color | Color | The new first alternating column color in the banding; setting tonull clears the color. |
Return
Banding — This banding, 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
setFirstRowColor(color)
Sets the first row color that is alternating.
Parameters
| Name | Type | Description |
|---|---|---|
color | String | The color code in CSS notation (such as'#ffffff' or'white'), ornull to clear the color. |
Return
Banding — This banding, 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
setFirstRowColorObject(color)
Sets the first alternating row color in the banding.
Parameters
| Name | Type | Description |
|---|---|---|
color | Color | The new first alternating color in the banding; setting tonull clears the color. |
Return
Banding — This banding, 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
setFooterColumnColor(color)
Sets the color of the last column.
Parameters
| Name | Type | Description |
|---|---|---|
color | String | The color code in CSS notation (such as'#ffffff' or'white'), ornull to clear the color. |
Return
Banding — This banding, 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
setFooterColumnColorObject(color)
Sets the color of the last column in the banding.
Parameters
| Name | Type | Description |
|---|---|---|
color | Color | The new color of the last column in the banding; setting tonull clears the color. |
Return
Banding — This banding, 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
setFooterRowColor(color)
Sets the color of the last row.
Parameters
| Name | Type | Description |
|---|---|---|
color | String | The color code in CSS notation (such as'#ffffff' or'white'), ornull to clear the color. |
Return
Banding — This banding, 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
setFooterRowColorObject(color)
Sets the color of the footer row in the banding.
Parameters
| Name | Type | Description |
|---|---|---|
color | Color | The new footer row color; setting tonull clears the color. |
Return
Banding — This banding, 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
setHeaderColumnColor(color)
Sets the color of the header column.
Parameters
| Name | Type | Description |
|---|---|---|
color | String | The color code in CSS notation (such as'#ffffff' or'white'), ornull to clear the color. |
Return
Banding — This banding, 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
setHeaderColumnColorObject(color)
Sets the color of the header column.
Parameters
| Name | Type | Description |
|---|---|---|
color | Color | The new header column color; setting tonull clears the color. |
Return
Banding — This banding, 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
setHeaderRowColor(color)
Sets the color of the header row.
Parameters
| Name | Type | Description |
|---|---|---|
color | String | The color code in CSS notation (such as'#ffffff' or'white'), ornull to clear the color. |
Return
Banding — This banding, 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
setHeaderRowColorObject(color)
Sets the color of the header row.
Parameters
| Name | Type | Description |
|---|---|---|
color | Color | The new header row color; setting tonull clears the color. |
Return
Banding — This banding, 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
setRange(range)
Sets the range for this banding.
Parameters
| Name | Type | Description |
|---|---|---|
range | Range | 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 followingscopes:
https://www.googleapis.com/auth/spreadsheets.currentonlyhttps://www.googleapis.com/auth/spreadsheets
setSecondColumnColor(color)
Sets the second column color that is alternating.
Parameters
| Name | Type | Description |
|---|---|---|
color | String | The color code in CSS notation (such as'#ffffff' or'white'), ornull to clear the color. |
Return
Banding — This banding, 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
setSecondColumnColorObject(color)
Sets the second alternating column color in the banding.
Parameters
| Name | Type | Description |
|---|---|---|
color | Color | The new second alternating column color in the banding; setting tonull clears the color. |
Return
Banding — This banding, 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
setSecondRowColor(color)
Sets the second row color that is alternating.
Parameters
| Name | Type | Description |
|---|---|---|
color | String | The color code in CSS notation (such as'#ffffff' or'white'), ornull to clear the color. |
Return
Banding — This banding, 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
setSecondRowColorObject(color)
Sets the second alternating color in the banding.
Parameters
| Name | Type | Description |
|---|---|---|
color | Color | The new second alternating color in the banding; setting tonull clears the color. |
Return
Banding — This banding, 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
Deprecated methods
getFirstColumnColor()
getFirstColumnColor() Deprecated. Replaced byget
Returns the first column color that is alternating, ornull if no color is set.
Return
String|null — The color code in CSS notation (such as'#ffffff' or'white'), ornull if no color is set.
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
getFirstRowColor()
getFirstRowColor() Deprecated. Replaced byget
Returns the first row color that is alternating ornull if no color is set.
Return
String|null — The color code in CSS notation (such as'#ffffff' or'white'), ornull if no color is set.
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
getFooterColumnColor()
getFooterColumnColor() Deprecated. Replaced byget
Returns the color of the last column, ornull if no color is set.
Return
String|null — The color code in CSS notation (such as'#ffffff' or'white'), ornull if no color is set.
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
getFooterRowColor()
getFooterRowColor() Deprecated. Replaced byget
Returns the color of the last row, ornull if no color is set.
Return
String|null — The color code in CSS notation (such as'#ffffff' or'white'), ornull if no color is set.
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
getHeaderColumnColor()
getHeaderColumnColor() Deprecated. Replaced byget
Returns the color of the header column, ornull if no color is set.
Return
String|null — The color code in CSS notation (such as'#ffffff' or'white'), ornull if no color is set.
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
getHeaderRowColor()
getHeaderRowColor() Deprecated. Replaced byget
Returns the color of the header row ornull if no color is set.
Return
String|null — The color code in CSS notation (such as'#ffffff' or'white'), ornull if no color is set.
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
getSecondColumnColor()
getSecondColumnColor() Deprecated. Replaced byget
Returns the second column color that is alternating, ornull if no color is set.
Return
String|null — The HEX color ornull if no color is set.
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
getSecondRowColor()
getSecondRowColor() Deprecated. Replaced byget
Returns the second row color that is alternating ornull if no color is set.
Return
String|null — The color code in CSS notation (such as'#ffffff' or'white'), ornull if no color is set.
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.