フィードバックを送信
Class Slicer
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
詳細なドキュメント
getBackgroundColorObject()
スライサーの背景 Color
を返します。
戻る
Color
- このスライサーの背景色。色が設定されていない場合は null
を返します。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getColumnPosition()
スライサーでフィルタが適用されている列の位置(スライサーのデータ範囲を基準とする)を返します。列の位置が設定されていない場合は null
を返します。これは、フィルタと同様に、1 からインデックスされた列の位置にする必要があります。
戻る
Integer
- このスライサーの列位置。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getContainerInfo()
シート内でのスライサーの位置に関する情報を取得します。
戻る
ContainerInfo
- スライサーのコンテナの位置を含むオブジェクト。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getFilterCriteria()
スライサーのフィルタ条件を返します。フィルタ条件が設定されていない場合は null
を返します。
戻る
FilterCriteria
- このスライサーのフィルタ条件。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getRange()
スライサーが適用されるデータ範囲を取得します。
戻る
Range
- スライサーの範囲。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getTitle()
スライサーのタイトルを返します。
戻る
String
- チェーン用のスライサー。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getTitleHorizontalAlignment()
タイトルの水平方向の配置を取得します。
戻る
String
- このスライサーのタイトルの水平方向の配置。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getTitleTextStyle()
スライサーのタイトルのテキスト スタイルを返します。
戻る
TextStyle
- このスライサーのタイトルのテキスト スタイル。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
isAppliedToPivotTables()
指定されたスライサーがピボット テーブルに適用されているかどうかを返します。
戻る
Boolean
- このスライサーがピボット テーブルに適用されている場合は true
、それ以外の場合は false
。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
remove()
スライサーを削除します。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setApplyToPivotTables(applyToPivotTables)
指定したスライサーをワークシート内のピボット テーブルに適用するかどうかを設定します。
パラメータ
名前 型 説明
applyToPivotTables
Boolean
このスライサーをピボット テーブルに適用するかどうかを指定します。
戻る
Slicer
- チェーン用のスライサー。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setBackgroundColor(color)
スライサーの背景色を設定します。null
値は背景色をリセットします。
パラメータ
名前 型 説明
color
String
このスライサーの新しい背景色(CSS 表記:「#ffffff」など)。
戻る
Slicer
- チェーン用のスライサー。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setBackgroundColorObject(color)
スライサーの背景 Color
を設定します。null
値は背景色をリセットします。
パラメータ
名前 型 説明
color
Color
このスライサーの新しい背景色。
戻る
Slicer
- チェーン用のスライサー。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setColumnFilterCriteria(columnPosition, filterCriteria)
スライサーの列番号とフィルタ条件を設定します。null
値はスライサー フィルタをリセットします。
パラメータ
名前 型 説明
columnPosition
Integer
このスライサーの新しい列位置。
filterCriteria
FilterCriteria
このスライサーの新しいフィルタ条件。
戻る
Slicer
- チェーン用のスライサー。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setPosition(anchorRowPos, anchorColPos, offsetX, offsetY)
シート上にスライサーが表示される位置を設定します。アンカーの行と列の位置のインデックスは 1 から始まります。
パラメータ
名前 型 説明
anchorRowPos
Integer
スライサーの上部は、この行に固定されます。
anchorColPos
Integer
スライサーの上部がこの列に固定されます。
offsetX
Integer
セルの角からの水平方向のオフセット(ピクセル単位)。
offsetY
Integer
セルの角からの垂直オフセット(ピクセル単位)。
戻る
Slicer
- チェーン用のスライサー。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setRange(rangeApi)
スライサーを適用するデータ範囲を設定します。
パラメータ
名前 型 説明
rangeApi
Range
このスライサーの新しい範囲。
戻る
Slicer
- チェーン用のスライサー。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setTitle(title)
スライサーのタイトルを設定します。タイトルが空白の場合、タイトルはデフォルト値にリセットされます。
パラメータ
名前 型 説明
title
String
このスライサーの新しいタイトル。
戻る
Slicer
- チェーン用のスライサー。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setTitleHorizontalAlignment(horizontalAlignment)
スライサーのタイトルの水平方向の配置を設定します。null
値は、配置をリセットします。
パラメータ
名前 型 説明
horizontalAlignment
String
このスライサーのタイトルの新しい水平方向の配置。
戻る
Slicer
- チェーン用のスライサー。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setTitleTextStyle(textStyle)
スライサーのテキスト スタイルを設定します。
パラメータ
名前 型 説明
textStyle
TextStyle
スライサーのタイトルの新しいテキスト スタイル。
戻る
Slicer
- チェーン用のスライサー。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
サポート終了のメソッド
getBackgroundColor()
非推奨 。getBackgroundColorObject()
に置き換え
スライサーの背景色を CSS 表記(「#ffffff」など)で返します。
戻る
String
- このスライサーの背景色。色が設定されていない場合は null
を返します。
承認
このメソッドを使用するスクリプトには、次のスコープ の 1 つ以上による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
フィードバックを送信
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンス により使用許諾されます。コードサンプルは Apache 2.0 ライセンス により使用許諾されます。詳しくは、Google Developers サイトのポリシー をご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-12-03 UTC。
ご意見をお聞かせください
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 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"]]