存取及修改資料透視表細分群組。
方法
內容詳盡的說明文件
add Manual Grouping Rule(groupName, groupMembers)
為這個資料透視表群組新增手動分組規則。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
group | String | 這項分組規則的名稱。 |
group | Object[] | 這個分組規則中包含的值。 |
回攻員
Pivot:用於串連的樞紐群組。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
are Labels Repeated()
傳回標籤是否重複顯示。
回攻員
Boolean:如果標籤重複,則為 true,否則為 false。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
clear Grouping Rule()
從這個資料透視表群組中移除所有分組規則。
回攻員
Pivot:用於串連的樞紐群組。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
clear Sort()
移除套用至這個群組的所有排序方式。
回攻員
Pivot:用於串連的樞紐群組。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
get Date Time Grouping Rule()
傳回資料透視表元素分組的日期時間分組規則,如果未設定日期時間分組規則,則傳回 null。
回攻員
Date - 日期時間分組規則。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
get Dimension()
get Group Limit()
傳回資料透視表元素群組的限制。如果未設定資料透視表群組限制,則傳回 null。
回攻員
Pivot:資料透視表元素群組限制。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
get Index()
傳回這個資料透視表元素群組在目前群組順序中的索引。
回攻員
Integer:資料透視表元素群組的索引
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
get Pivot Table()
傳回這個分組所屬的 Pivot。
回攻員
Pivot:這個群組所屬的資料透視表。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
get Source Data Column()
傳回這個群組匯總的來源資料欄數量。這個索引是以 1 為基準,如果這個群組會彙整試算表「A」欄中的來源資料,這個方法就會傳回 1。
回攻員
Integer - 來源資料欄編號
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
get Source Data Source Column()
傳回資料透視群組運算的資料來源資料欄。如果資料透視表不是 {DataSourcePivotTableApi},則傳回 null。
回攻員
Data:資料透視群組運算的資料來源欄。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
hide Repeated Labels()
隱藏這個分組的重複標籤。如果標籤已隱藏,這會導致無作業。 如果是在有多個資料列或資料欄分組之前呼叫這個方法,當新增其他分組時,系統會隱藏重複的標籤。
回攻員
Pivot:用於串連的樞紐群組。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
is Sort Ascending()
如果排序方式為遞增,則傳回 true;如果排序方式為遞減,則傳回 false。
回攻員
Boolean - true:如果排序順序為遞增。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
move To Index(index)
將這個群組移至目前列或欄群組清單中的指定位置。這些索引是以 0 為基準。舉例來說,如果這個群組應移至第一個位置,則應使用 0 呼叫這個方法。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
index | Integer | 要將這個分組移至的索引。 |
回攻員
Pivot:用於串連的樞紐群組。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
remove()
從資料表中移除這個樞紐群組。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
remove Manual Grouping Rule(groupName)
移除具有指定 group 的手動分組規則。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
group | String | 要移除的分組規則名稱。 |
回攻員
Pivot:用於串連的樞紐群組。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
reset Display Name()
將資料透視表中這個群組的顯示名稱重設為預設值。
回攻員
Pivot:用於串連的樞紐群組。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
set Date Time Grouping Rule(dateTimeGroupingRuleType)
在資料透視表元素分組中設定日期時間分組規則。
如要移除規則,請使用 clear。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
date | Date | 要設定的規則類型。 |
回攻員
Pivot:樞紐群組,用於鏈結。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
set Display Name(name)
在樞紐分析表中設定這個群組的顯示名稱。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
name | String | 要設定的顯示名稱。 |
回攻員
Pivot:用於鏈結的樞紐群組
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
set Group Limit(countLimit)
設定資料透視表元素群組的限制。這項操作僅支援 Data。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
count | Integer | 要設定的列數或欄數上限。必須為正數。 |
回攻員
Pivot:用於串連的樞紐群組。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
set Histogram Grouping Rule(minValue, maxValue, intervalSize)
為這個資料透視表群組設定直方圖分組規則。直方圖規則會將來源資料欄中的值整理到大小固定的值區中。從 min 到 max 的所有值都會放入大小為 interval 的群組。所有低於 min 的值會歸入一個值區,所有高於 max 的值也會歸入一個值區。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
min | Integer | 項目可放入儲存區的最低值。小於這個值的值會合併為單一特徵分塊。 |
max | Integer | 要放入 bucket 的項目最大值。大於這個值的值會合併為單一特徵分塊。 |
interval | Integer |
回攻員
Pivot:用於串連的樞紐群組。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
show Repeated Labels()
如果有多個資料列或資料欄分組,這個方法會為後續分組的每個項目顯示該分組的標籤。如果標籤已重複,這會導致無作業。如果這個方法是在有多個資料列或資料欄分組之前呼叫,當新增其他分組時,系統會顯示重複的標籤。
回攻員
Pivot:用於串連的樞紐群組。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
show Totals(showTotals)
設定是否要在表格中顯示這個資料透視群組的總值。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
show | Boolean | 是否顯示總計。 |
回攻員
Pivot:用於串連的樞紐群組。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
sort Ascending()
將排序順序設為遞增。
回攻員
Pivot:用於串連的樞紐群組。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
sort By(value, oppositeGroupValues)
依指定 Pivot,針對 opposite 中的值排序這個群組。
// Sorts the item group by the "SUM of Quantity" pivot value for the specified // salespersons. const sheet = SpreadsheetApp.getActiveSheet(); const pivotTable = sheet.getPivotTables()[0]; const itemGroup = pivotTable.getRowGroups()[0]; const sumQuantityValue = pivotTable.getPivotValues()[0]; itemGroup.sortBy(sumQuantityValue, ['Beth', 'Amir', 'Devyn']);
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
value | Pivot | 做為排序依據的樞紐分析值。 |
opposite | Object[] | 用於排序的相反資料透視表群組值 (如果是排序資料列群組,則為資料欄群組;如果是排序資料欄群組,則為資料列群組)。這些值的順序會決定優先順序,以打破平手局面。 |
回攻員
Pivot:用於串連的樞紐群組。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
sort Descending()
將排序順序設為遞減。
回攻員
Pivot:用於串連的樞紐群組。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
totals Are Shown()
傳回目前是否顯示這個樞紐群組的總值。
回攻員
Boolean:如果顯示這個樞紐群組的總值,則為 true;否則為 false。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets