संग्रह की मदद से व्यवस्थित रहें अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
ग्रुप
स्प्रेडशीट ग्रुप को ऐक्सेस और उनमें बदलाव कर सकता है. ग्रुप, लगातार पंक्तियों या कॉलम के इंटरवल के बीच का संबंध होता है. पंक्तियों या कॉलम को छिपाने/दिखाने के लिए, इन्हें एक यूनिट के तौर पर बड़ा या छोटा किया जा सकता है. हर ग्रुप में, ग्रुप से ठीक पहले या बाद में (सेटिंग के हिसाब से) मौजूद लाइन या कॉलम पर कंट्रोल टॉगल होता है. इससे पूरे ग्रुप को बड़ा या छोटा किया जा सकता है.
किसी ग्रुप की डेप्थ से पता चलता है कि ग्रुप को नेस्टेड करने के लिए किस लेवल पर रखा गया है. साथ ही, यह भी पता चलता है कि कितने बड़े ग्रुप में यह ग्रुप शामिल है. किसी ग्रुप की छोटी की गई स्थिति से पता चलता है कि पैरंट ग्रुप को बड़ा करने के बाद, ग्रुप को छोटा किया जाना चाहिए या बड़ा किया जाना चाहिए. इसके अलावा, जब किसी ग्रुप को छोटा या बड़ा किया जाता है, तब ग्रुप में मौजूद पंक्तियों या कॉलम को छिपाया जाता है या दिखाया जाता है. हालांकि, किसी ग्रुप को छोटा किए जाने की स्थिति के बावजूद, अलग-अलग पंक्तियों या कॉलम को छिपाया या दिखाया जा सकता है.
इस ग्रुप को शीट से हटाता है. इससे range की ग्रुप डेप्थ एक कम हो जाती है.
ज़्यादा जानकारी वाला दस्तावेज़
collapse()
इस ग्रुप को छोटा करता है.
constsheet=SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];constrange=sheet.getRange('2:3');range.shiftRowGroupDepth(1);constgroup=sheet.getRowGroup(2,1);// Collapses this group.group.collapse();
constsheet=SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];constrange=sheet.getRange('2:3');range.shiftRowGroupDepth(1);constgroup=sheet.getRowGroup(2,1);// Expands this group.group.expand();
इस ग्रुप के कंट्रोल टॉगल का इंडेक्स दिखाता है. यह रेंज से ठीक पहले का इंडेक्स होता है. ऐसा तब होता है, जब कंट्रोल टॉगल को ग्रुप से पहले दिखाया जाता है. इसके अलावा, यह रेंज के ठीक बाद का इंडेक्स होता है.
constsheet=SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];constrange=sheet.getRange('2:3');range.shiftRowGroupDepth(1);constgroup=sheet.getRowGroup(2,1);// Returns 1 if the group is at depth 1.constdepth=group.getDepth();
वापसी का टिकट
Integer — इस ग्रुप की गहराई.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:
यह फ़ंक्शन, उस रेंज को दिखाता है जिसमें यह ग्रुप मौजूद है.
constsheet=SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];letrange=sheet.getRange('2:3');range.shiftRowGroupDepth(1);constgroup=sheet.getRowGroup(1,1);// Returns the range 2:3 if the group is over rows 2:3range=group.getRange();
अगर इस ग्रुप को छोटा किया गया है, तो रिस्पॉन्स के तौर पर true मिलता है.
constsheet=SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];constrange=sheet.getRange('2:3');range.shiftRowGroupDepth(1);constgroup=sheet.getRowGroup(2,1);// Returns true if the group is collapsed.constisCollapsed=group.isCollapsed();
वापसी का टिकट
Boolean — true अगर इस ग्रुप को छोटा किया गया है, तो false दिखाता है.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:
इस ग्रुप को शीट से हटाता है. इससे range की ग्रुप डेप्थ एक कम हो जाती है. इससे अन्य ग्रुप में बदलाव हो सकता है. इसे कॉल करने के बाद, ग्रुप ऑब्जेक्ट का इस्तेमाल नहीं किया जा सकता.
constsheet=SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];letrange=sheet.getRange('2:3');range.shiftRowGroupDepth(1);constgroup=sheet.getRowGroup(2,1);// Removes this grouprange=group.remove();
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:
[[["समझने में आसान है","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"]],["आखिरी बार 2025-08-13 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eGroups in Google Sheets allow you to associate contiguous rows or columns, enabling them to be expanded or collapsed as a single unit to control visibility.\u003c/p\u003e\n"],["\u003cp\u003eEach group has a control toggle located before or after the group, which dictates whether the group is expanded or collapsed, affecting the visibility of its rows or columns.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGroup\u003c/code\u003e class in Apps Script provides methods to programmatically manage groups, including collapsing, expanding, retrieving group properties, and removing groups.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGroup\u003c/code\u003e methods like \u003ccode\u003ecollapse()\u003c/code\u003e, \u003ccode\u003eexpand()\u003c/code\u003e, \u003ccode\u003egetControlIndex()\u003c/code\u003e, \u003ccode\u003egetDepth()\u003c/code\u003e, \u003ccode\u003egetRange()\u003c/code\u003e, \u003ccode\u003eisCollapsed()\u003c/code\u003e, and \u003ccode\u003eremove()\u003c/code\u003e offer control over group behavior and properties within your scripts.\u003c/p\u003e\n"],["\u003cp\u003eUtilizing these methods allows for dynamic manipulation of spreadsheet groups, enhancing the interactivity and organization of your spreadsheet data through automation.\u003c/p\u003e\n"]]],[],null,["Group\n\nAccess and modify spreadsheet groups. Groups are an association between an interval of contiguous\nrows or columns that can be expanded or collapsed as a unit to hide/show the rows or columns.\nEach group has a *control toggle* on the row or column directly before or after the group\n(depending on settings) that can expand or collapse the group as a whole.\n\nThe *depth* of a group refers to the nested position of the group and how many larger\ngroups contain the group. The *collapsed state* of a group refers to whether the group\nshould remain collapsed or expanded after a parent group has been expanded. Additionally, at the\ntime that a group is collapsed or expanded, the rows or columns within the group are hidden or\nset visible, though individual rows or columns can be hidden or set visible irrespective of the\ncollapsed state. \n\nMethods\n\n| Method | Return type | Brief description |\n|-----------------------------------------|---------------------------------------------------|-------------------------------------------------------------------------------------------------|\n| [collapse()](#collapse()) | [Group](#) | Collapses this group. |\n| [expand()](#expand()) | [Group](#) | Expands this group. |\n| [getControlIndex()](#getControlIndex()) | `Integer` | Returns the control toggle index of this group. |\n| [getDepth()](#getDepth()) | `Integer` | Returns the depth of this group. |\n| [getRange()](#getRange()) | [Range](/apps-script/reference/spreadsheet/range) | Returns the range over which this group exists. |\n| [isCollapsed()](#isCollapsed()) | `Boolean` | Returns `true` if this group is collapsed. |\n| [remove()](#remove()) | `void` | Removes this group from the sheet, reducing the group depth of the [range](#getRange()) by one. |\n\nDetailed documentation \n\n`collapse()` \nCollapses this group.\n\n```javascript\nconst sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];\nconst range = sheet.getRange('2:3');\nrange.shiftRowGroupDepth(1);\nconst group = sheet.getRowGroup(2, 1);\n\n// Collapses this group.\ngroup.collapse();\n```\n\nReturn\n\n\n[Group](#) --- this group, for chaining\n\nAuthorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`\n\n*** ** * ** ***\n\n`expand()` \nExpands this group.\n\n```javascript\nconst sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];\nconst range = sheet.getRange('2:3');\nrange.shiftRowGroupDepth(1);\nconst group = sheet.getRowGroup(2, 1);\n\n// Expands this group.\ngroup.expand();\n```\n\nReturn\n\n\n[Group](#) --- this group, for chaining\n\nAuthorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`\n\n*** ** * ** ***\n\n`get``Control``Index()` \nReturns the control toggle index of this group. This is the index just before the range when\nthe control toggle is shown before the group, or the index just after the range otherwise.\n\n```javascript\nconst sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];\nsheet.setRowGroupControlAfter(true);\nconst range = sheet.getRange('2:3');\nrange.shiftRowGroupDepth(1);\nconst group = sheet.getRowGroup(2, 1);\n\n// Returns 4\nconst controlIndex = group.getControlIndex();\n```\n\nReturn\n\n\n`Integer` --- the control toggle index of this group\n\nAuthorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`\n\n*** ** * ** ***\n\n`get``Depth()` \nReturns the depth of this group.\n\n```javascript\nconst sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];\nconst range = sheet.getRange('2:3');\nrange.shiftRowGroupDepth(1);\nconst group = sheet.getRowGroup(2, 1);\n\n// Returns 1 if the group is at depth 1.\nconst depth = group.getDepth();\n```\n\nReturn\n\n\n`Integer` --- the depth of this group\n\nAuthorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`\n\n*** ** * ** ***\n\n`get``Range()` \nReturns the range over which this group exists.\n\n```javascript\nconst sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];\nlet range = sheet.getRange('2:3');\nrange.shiftRowGroupDepth(1);\nconst group = sheet.getRowGroup(1, 1);\n\n// Returns the range 2:3 if the group is over rows 2:3\nrange = group.getRange();\n```\n\nReturn\n\n\n[Range](/apps-script/reference/spreadsheet/range) --- the range over which the group exists\n\nAuthorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`\n\n*** ** * ** ***\n\n`is``Collapsed()` \nReturns `true` if this group is collapsed.\n\n```javascript\nconst sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];\nconst range = sheet.getRange('2:3');\nrange.shiftRowGroupDepth(1);\nconst group = sheet.getRowGroup(2, 1);\n\n// Returns true if the group is collapsed.\nconst isCollapsed = group.isCollapsed();\n```\n\nReturn\n\n\n`Boolean` --- `true` if this group is collapsed; returns `false` otherwise\n\nAuthorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`\n\n*** ** * ** ***\n\n`remove()` \nRemoves this group from the sheet, reducing the group depth of the [range](#getRange()) by\none. This may modify other groups. After calling this, the group object becomes invalid to use.\n\n```javascript\nconst sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];\nlet range = sheet.getRange('2:3');\nrange.shiftRowGroupDepth(1);\nconst group = sheet.getRowGroup(2, 1);\n\n// Removes this group\nrange = group.remove();\n```\n\nAuthorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`\n\nSee also\n\n- [Range.shiftRowGroupDepth(delta)](/apps-script/reference/spreadsheet/range#shiftRowGroupDepth(Integer))\n- [Range.shiftColumnGroupDepth(delta)](/apps-script/reference/spreadsheet/range#shiftColumnGroupDepth(Integer))"]]