Stay organized with collections Save and categorize content based on your preferences.
Methods Deprecated methods Method Return type Brief descriptiongetBackgroundColor()
String
Returns the background color of the slicer in CSS notation (such as '#ffffff'). Detailed documentation getBackgroundColorObject()
Return the background Color
of the slicer.
Color
— The background color of this slicer. Returns null
if no color is set.
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
getColumnPosition()
Returns the column position (relative to the data range of the slicer) on which the filter is applied in the slicer, or null
if the column position is not set. This should be 1-indexed position of the column similar to filter.
Integer
— The column position of this slicer.
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
getContainerInfo()
Gets information about where the slicer is positioned in the sheet.
ReturnContainerInfo
— An object containing the slicer's container position.
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
getFilterCriteria()
Returns the filter criteria of the slicer, or null
if the filter criteria is not set.
FilterCriteria
— The filter criteria of this slicer.
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()
Gets the data range on which the slicer is applied to.
ReturnRange
— The slicer range.
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
getTitle()
Returns the title of the slicer.
ReturnString
— This slicer, for chaining.
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
getTitleHorizontalAlignment()
Gets the horizontal alignment of the title.
ReturnString
— The horizontal alignment of this slicer's title.
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
getTitleTextStyle()
Returns the text style of the slicer's title.
ReturnTextStyle
— The text style of this slicer's title.
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
isAppliedToPivotTables()
Returns whether the given slicer is applied to pivot tables.
ReturnBoolean
— true
if this slicer is applied to pivot tables, otherwise false
.
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()
Deletes the slicer.
AuthorizationScripts 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
setApplyToPivotTables(applyToPivotTables)
Sets if the given slicer should be applied to pivot tables in the worksheet.
Parameters Name Type DescriptionapplyToPivotTables
Boolean
Specifies whether this slicer should apply to pivot tables. Return
Slicer
— This slicer, for chaining.
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
setBackgroundColor(color)
Sets the background color of the slicer. A null
value resets the background color.
color
String
The new background color of this slicer in CSS notation (such as '#ffffff'). Return
Slicer
— This slicer, for chaining.
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
setBackgroundColorObject(color)
Sets the background Color
of the slicer. A null
value resets the background color.
color
Color
The new background color of this slicer. Return
Slicer
— This slicer, for chaining.
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
setColumnFilterCriteria(columnPosition, filterCriteria)
Sets the column index and filtering criteria of the slicer. A null
value resets the slicer filter.
columnPosition
Integer
The new column position of this slicer. filterCriteria
FilterCriteria
The new filter criteria of this slicer. Return
Slicer
— This slicer, for chaining.
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
setPosition(anchorRowPos, anchorColPos, offsetX, offsetY)
Sets the position where the slicer appears on the sheet. The anchor row and column position indices are 1-indexed.
Parameters Name Type DescriptionanchorRowPos
Integer
The slicer's top side is anchored in this row. anchorColPos
Integer
The slicer's top side is anchored in this col. offsetX
Integer
The horizontal offset from cell corner in pixels. offsetY
Integer
The vertical offset from cell corner in pixels. Return
Slicer
— This slicer, for chaining.
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(rangeApi)
Sets the data range on which the slicer is applied.
Parameters Name Type DescriptionrangeApi
Range
The new range for this slicer. Return
Slicer
— This slicer, for chaining.
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
setTitle(title)
Sets the title of the slicer. An empty title resets the title to default value.
Parameters Name Type Descriptiontitle
String
The new title of this slicer. Return
Slicer
— This slicer, for chaining.
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
setTitleHorizontalAlignment(horizontalAlignment)
Sets the horizontal alignment of the title in the slicer. A null
value resets the alignment.
horizontalAlignment
String
The new horizontal alignment of this slicer's title. Return
Slicer
— This slicer, for chaining.
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
setTitleTextStyle(textStyle)
Sets the text style of the slicer.
Parameters Name Type DescriptiontextStyle
TextStyle
The new text style of the slicer's title. Return
Slicer
— This slicer, for chaining.
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
getBackgroundColor()
Deprecated. Replaced by getBackgroundColorObject()
Returns the background color of the slicer in CSS notation (such as '#ffffff').
ReturnString
— The background color of this slicer. Returns null
if no color is set.
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 2024-12-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-03 UTC."],[[["The `Slicer` class allows you to programmatically control slicers in Google Sheets, enabling you to filter data in ranges, charts, and pivot tables without collaboration."],["You can access and modify existing slicers or create new ones using the provided methods, such as setting the data range, background color, title, and position."],["The `Slicer` class offers various methods for customizing the slicer's appearance, including setting the background color, title alignment, and text style."],["To use the `Slicer` class effectively, you will need to authorize your script with the necessary scopes to access and modify spreadsheet data."],["Several methods are available for interacting with the slicer's filter criteria, allowing you to retrieve, set, and manipulate the filtering conditions applied to the data."]]],["Slicers filter ranges, charts, and pivot tables. Key actions include: retrieving and modifying slicer properties like background color, column position, filter criteria, data range, and title. Slicers can be positioned and have their applicability to pivot tables set. You can also manage the title's horizontal alignment and text style. Slicers are created using `Sheet.insertSlicer`. The method to remove a slicer is `remove()`. The old method to obtain background colors is deprecated and should be replaced by `getBackgroundColorObject()`.\n"]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4