Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
フィードバックを送信
Class Slicer
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
詳細なドキュメント
getBackgroundColorObject()
スライサーの背景 Color を返します。
戻る
Color |null - このスライサーの背景色。色が設定されていない場合は null を返します。
承認
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープ による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getColumnPosition()
スライサーでフィルタが適用される列の位置(スライサーのデータ範囲に対する相対位置)を返します。列の位置が設定されていない場合は null を返します。これは、フィルタと同様に、列の 1 から始まるインデックス付きの位置です。
戻る
Integer|null - このスライサーの列位置。
承認
このメソッドを使用するスクリプトには、次の 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 |null - このスライサーのフィルタ条件。
承認
このメソッドを使用するスクリプトには、次の 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)
指定したスライサーをワークシートのピボット テーブルに適用するかどうかを設定します。
パラメータ
名前 タイプ 説明
apply To Pivot TablesBooleanこのスライサーをピボット テーブルに適用するかどうかを指定します。
戻る
Slicer - チェーン用のこのスライサー。
承認
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープ による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setBackgroundColor(color)
スライサーの背景色を設定します。null 値は背景色をリセットします。
パラメータ
名前 タイプ 説明
colorStringこのスライサーの新しい背景色(CSS 表記(「#ffffff」など))。
戻る
Slicer - チェーン用のこのスライサー。
承認
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープ による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setBackgroundColorObject(color)
スライサーの背景 Color を設定します。null 値は背景色をリセットします。
パラメータ
名前 タイプ 説明
colorColor このスライサーの新しい背景色。
戻る
Slicer - チェーン用のこのスライサー。
承認
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープ による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setColumnFilterCriteria(columnPosition, filterCriteria)
スライサーの列インデックスとフィルタリング条件を設定します。null 値はスライサー フィルタをリセットします。
パラメータ
名前 タイプ 説明
column PositionIntegerこのスライサーの新しい列の位置。
filter CriteriaFilter Criteria このスライサーの新しいフィルタ条件。
戻る
Slicer - チェーン用のこのスライサー。
承認
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープ による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setPosition(anchorRowPos, anchorColPos, offsetX, offsetY)
シートにスライサーが表示される位置を設定します。アンカー行と列の位置インデックスは 1 から始まります。
パラメータ
名前 タイプ 説明
anchor Row PosIntegerスライサーの上部がこの行に固定されます。
anchor Col PosIntegerスライサーの上側はこの列に固定されます。
offsetXIntegerセルの角からの水平オフセット(ピクセル単位)。
offsetYIntegerセルの角からの垂直オフセット(ピクセル単位)。
戻る
Slicer - チェーン用のこのスライサー。
承認
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープ による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setRange(rangeApi)
スライサーが適用されるデータ範囲を設定します。
パラメータ
名前 タイプ 説明
range ApiRange このスライサーの新しい範囲。
戻る
Slicer - チェーン用のこのスライサー。
承認
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープ による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setTitle(title)
スライサーのタイトルを設定します。タイトルを空にすると、タイトルがデフォルト値にリセットされます。
パラメータ
名前 タイプ 説明
titleStringこのスライサーの新しいタイトル。
戻る
Slicer - チェーン用のこのスライサー。
承認
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープ による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setTitleHorizontalAlignment(horizontalAlignment)
スライサーのタイトルの水平方向の配置を設定します。null 値は配置をリセットします。
パラメータ
名前 タイプ 説明
horizontal AlignmentStringこのスライサーのタイトルの新しい水平方向の配置。
戻る
Slicer - チェーン用のこのスライサー。
承認
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープ による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setTitleTextStyle(textStyle)
スライサーのテキスト スタイルを設定します。
パラメータ
名前 タイプ 説明
text StyleText Style スライサーのタイトルの新しいテキスト スタイル。
戻る
Slicer - チェーン用のこのスライサー。
承認
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープ による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
サポート終了のメソッド
getBackgroundColor()
非推奨 。getBackgroundColorObject() に置き換え
スライサーの背景色を CSS 表記(「#ffffff」など)で返します。
戻る
String|null - このスライサーの背景色。色が設定されていない場合は null を返します。
承認
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープ による承認が必要です。
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
フィードバックを送信
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンス により使用許諾されます。コードサンプルは Apache 2.0 ライセンス により使用許諾されます。詳しくは、Google Developers サイトのポリシー をご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2026-04-13 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"]],["最終更新日 2026-04-13 UTC。"],[],["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"]]