Page Summary
-
The
Sheetobject in Google Apps Script provides extensive methods for accessing and modifying individual sheets within a spreadsheet. -
You can perform common operations like activating, hiding/showing, and clearing sheet content and formatting.
-
The object allows for detailed manipulation of sheet structure, including inserting, deleting, and moving columns and rows.
-
It offers methods to get and set metadata, manage ranges and selections, control formatting and display options, work with groups, and interact with embedded objects like charts and images.
-
Many methods require specific authorization scopes to execute successfully.
Access and modify spreadsheet sheets. Common operations are renaming a sheet and accessing range objects from the sheet.
Methods
| Method | Return type | Brief description |
|---|---|---|
activate() | Sheet | Activates this sheet. |
add | Sheet | Adds developer metadata with the specified key to the sheet. |
add | Sheet | Adds developer metadata with the specified key and visibility to the sheet. |
add | Sheet | Adds developer metadata with the specified key and value to the sheet. |
add | Sheet | Adds developer metadata with the specified key, value, and visibility to the sheet. |
append | Sheet | Appends a row to the bottom of the current data region in the sheet. |
as | Data | Returns the sheet as a Data if the sheet is of type Sheet, or null otherwise. |
auto | Sheet | Sets the width of the given column to fit its contents. |
auto | Sheet | Sets the width of all columns starting at the given column position to fit their contents. |
auto | Sheet | Sets the height of all rows starting at the given row position to fit their contents. |
clear() | Sheet | Clears the sheet of content and formatting information. |
clear(options) | Sheet | Clears the sheet of contents and/or format, as specified with the given advanced options. |
clear | void | Removes all conditional format rules from the sheet. |
clear | Sheet | Clears the sheet of contents, while preserving formatting information. |
clear | Sheet | Clears the sheet of formatting, while preserving contents. |
clear | Sheet | Clears the sheet of all notes. |
collapse | Sheet | Collapses all column groups on the sheet. |
collapse | Sheet | Collapses all row groups on the sheet. |
copy | Sheet | Copies the sheet to a given spreadsheet, which can be the same spreadsheet as the source. |
create | Developer | Returns a Developer for finding developer metadata within the scope of
this sheet. |
create | Text | Creates a text finder for the sheet, which can find and replace text within the sheet. |
delete | Sheet | Deletes the column at the given column position. |
delete | void | Deletes a number of columns starting at the given column position. |
delete | Sheet | Deletes the row at the given row position. |
delete | void | Deletes a number of rows starting at the given row position. |
expand | Sheet | Expands all column groups on the sheet. |
expand | Sheet | Expands all row groups on the sheet. |
expand | Sheet | Expands all column groups up to the given depth, and collapses all others. |
expand | Sheet | Expands all row groups up to the given depth, and collapses all others. |
get | Range | Returns the active cell in this sheet. |
get | Range | Returns the selected range in the active sheet, or null if there is no active range. |
get | Range | Returns the list of active ranges in the active sheet or null if there are no active
ranges. |
get | Banding[] | Returns all the bandings in this sheet. |
get | Embedded | Returns an array of charts on this sheet. |