Class Range

रेंज

स्प्रेडशीट की रेंज को ऐक्सेस और उनमें बदलाव कर सकता है. रेंज, किसी शीट में मौजूद एक सेल या शीट में मौजूद आस-पास की सेल का ग्रुप हो सकता है.

तरीके

तरीकारिटर्न टाइपसंक्षिप्त विवरण
activate()Rangeयह फ़ंक्शन, तय की गई रेंज को active range के तौर पर सेट करता है. साथ ही, रेंज में सबसे ऊपर बाईं ओर मौजूद सेल को current cell के तौर पर सेट करता है.
activateAsCurrentCell()Rangeइस फ़ंक्शन से, तय की गई सेल को current cell के तौर पर सेट किया जाता है.
addDeveloperMetadata(key)Rangeयह फ़ंक्शन, रेंज में दी गई कुंजी के साथ डेवलपर मेटाडेटा जोड़ता है.
addDeveloperMetadata(key, visibility)Rangeयह फ़ंक्शन, रेंज में डेवलपर मेटाडेटा जोड़ता है. इसमें तय की गई कुंजी और दृश्यता होती है.
addDeveloperMetadata(key, value)Rangeयह फ़ंक्शन, रेंज में डेवलपर मेटाडेटा जोड़ता है. इसमें तय की गई कुंजी और वैल्यू शामिल होती है.
addDeveloperMetadata(key, value, visibility)Rangeयह फ़ंक्शन, रेंज में डेवलपर मेटाडेटा जोड़ता है. इसके लिए, तय की गई कुंजी, वैल्यू, और दिखने की सेटिंग का इस्तेमाल किया जाता है.
applyColumnBanding()Bandingइस फ़ंक्शन की मदद से, रेंज में डिफ़ॉल्ट कॉलम बैंडिंग थीम लागू की जाती है.
applyColumnBanding(bandingTheme)Bandingयह फ़ंक्शन, रेंज में कॉलम बैंडिंग की तय की गई थीम लागू करता है.
applyColumnBanding(bandingTheme, showHeader, showFooter)Bandingयह फ़ंक्शन, हेडर और फ़ुटर की सेटिंग के साथ-साथ तय की गई रेंज में, कॉलम बैंडिंग की थीम लागू करता है.
applyRowBanding()Bandingयह फ़ंक्शन, रेंज में लाइन के रंग को बदलने वाली डिफ़ॉल्ट थीम लागू करता है.
applyRowBanding(bandingTheme)Bandingयह फ़ंक्शन, रेंज में लाइन के रंग वाली थीम लागू करता है.
applyRowBanding(bandingTheme, showHeader, showFooter)Bandingयह फ़ंक्शन, हेडर और फ़ुटर की दी गई सेटिंग के साथ, तय की गई रेंज में लाइनें डालने की थीम लागू करता है.
autoFill(destination, series)voidइस रेंज में मौजूद डेटा के आधार पर, destinationRange में डेटा भरता है.
autoFillToNeighbor(series)voidयह आस-पास की सेल के आधार पर, नई वैल्यू भरने के लिए एक रेंज का हिसाब लगाता है. साथ ही, इस रेंज में मौजूद डेटा के आधार पर, नई वैल्यू अपने-आप भर देता है.
breakApart()Rangeरेंज में मौजूद एक से ज़्यादा कॉलम वाली किसी भी सेल को फिर से अलग-अलग सेल में बांटें.
canEdit()Booleanइस कुकी से यह तय होता है कि उपयोगकर्ता के पास रेंज में मौजूद हर सेल में बदलाव करने की अनुमति है या नहीं.
check()Rangeइस फ़ंक्शन की मदद से, रेंज में मौजूद चेकबॉक्स की स्थिति को “चुना गया” में बदला जा सकता है.
clear()Rangeइससे कॉन्टेंट और फ़ॉर्मैट की रेंज मिट जाती है.
clear(options)Rangeइससे कॉन्टेंट, फ़ॉर्मैट, डेटा की पुष्टि करने के नियम, और/या टिप्पणियों की रेंज मिट जाती है. ऐसा, दिए गए बेहतर विकल्पों के हिसाब से होता है.
clearContent()Rangeइस फ़ंक्शन की मदद से, रेंज में मौजूद कॉन्टेंट को मिटाया जा सकता है. हालांकि, फ़ॉर्मैटिंग में कोई बदलाव नहीं होता.
clearDataValidations()Rangeइस फ़ंक्शन का इस्तेमाल करके, रेंज के लिए डेटा की पुष्टि करने के नियमों को हटाया जा सकता है.
clearFormat()Rangeइससे इस रेंज के लिए फ़ॉर्मैटिंग हट जाती है.
clearNote()Rangeयह फ़ंक्शन, दी गई सेल या सेल में मौजूद नोट को मिटाता है.
collapseGroups()Rangeयह फ़ंक्शन, रेंज में पूरी तरह से शामिल सभी ग्रुप को छोटा करता है.
copyFormatToRange(gridId, column, columnEnd, row, rowEnd)voidरेंज की फ़ॉर्मैटिंग को दी गई जगह पर कॉपी करता है.
copyFormatToRange(sheet, column, columnEnd, row, rowEnd)voidरेंज की फ़ॉर्मैटिंग को दी गई जगह पर कॉपी करता है.
copyTo(destination)voidयह फ़ंक्शन, सेल की किसी रेंज से डेटा को सेल की दूसरी रेंज में कॉपी करता है.
copyTo(destination, copyPasteType, transposed)voidयह फ़ंक्शन, सेल की किसी रेंज से डेटा को सेल की दूसरी रेंज में कॉपी करता है.
copyTo(destination, options)voidयह फ़ंक्शन, सेल की किसी रेंज से डेटा को सेल की दूसरी रेंज में कॉपी करता है.
copyValuesToRange(gridId, column, columnEnd, row, rowEnd)voidरेंज के कॉन्टेंट को दी गई जगह पर कॉपी करता है.
copyValuesToRange(sheet, column, columnEnd, row, rowEnd)voidरेंज के कॉन्टेंट को दी गई जगह पर कॉपी करता है.
createDataSourcePivotTable(dataSource)DataSourcePivotTableयह फ़ंक्शन, डेटा सोर्स से एक खाली डेटा सोर्स पिवट टेबल बनाता है. यह टेबल, इस रेंज की पहली सेल में ऐंकर की जाती है.
createDataSourceTable(dataSource)DataSourceTableयह फ़ंक्शन, डेटा सोर्स से एक खाली डेटा सोर्स टेबल बनाता है. यह टेबल, इस रेंज के पहले सेल पर ऐंकर की जाती है.
createDeveloperMetadataFinder()DeveloperMetadataFinderयह फ़ंक्शन, इस रेंज के दायरे में डेवलपर मेटाडेटा ढूंढने के लिए DeveloperMetadataFinderApi दिखाता है.
createFilter()Filterयह फ़ंक्शन, फ़िल्टर बनाता है और उसे शीट पर मौजूद तय की गई रेंज पर लागू करता है.
createPivotTable(sourceData)PivotTableइस फ़ंक्शन की मदद से, तय की गई रेंज की पहली सेल में ऐंकर की गई sourceData से एक खाली पिवट टेबल बनाई जाती है.
createTextFinder(findText)TextFinderयह फ़ंक्शन, रेंज के लिए टेक्स्ट फ़ाइंडर बनाता है. इसकी मदद से, इस रेंज में टेक्स्ट ढूंढा और बदला जा सकता है.
deleteCells(shiftDimension)voidयह सेल की इस रेंज को मिटाता है.
expandGroups()Rangeयह फ़ंक्शन, उन छोटे किए गए ग्रुप को बड़ा करता है जिनकी रेंज या कंट्रोल टॉगल, इस रेंज से इंटरसेक्ट करता है.
getA1Notation()Stringयह फ़ंक्शन, A1 नोटेशन में रेंज की स्ट्रिंग के बारे में जानकारी देता है.
getBackground()Stringयह फ़ंक्शन, रेंज में सबसे ऊपर मौजूद बाएं सेल के बैकग्राउंड का रंग दिखाता है. उदाहरण के लिए, '#ffffff'.
getBackgroundObject()Colorयह फ़ंक्शन, रेंज में सबसे ऊपर मौजूद बाएं सेल के बैकग्राउंड का रंग दिखाता है.
getBackgroundObjects()Color[][]यह फ़ंक्शन, रेंज में मौजूद सेल के बैकग्राउंड के रंग दिखाता है.
getBackgrounds()String[][]यह फ़ंक्शन, रेंज में मौजूद सेल के बैकग्राउंड के रंग दिखाता है. उदाहरण के लिए, '#ffffff'.
getBandings()Banding[]इस फ़ंक्शन से, इस रेंज में मौजूद किसी भी सेल पर लागू की गई सभी बैंडिंग मिलती हैं.
getCell(row, column)Rangeयह फ़ंक्शन, किसी रेंज में मौजूद सेल की जानकारी देता है.
getColumn()Integerयह फ़ंक्शन, इस रेंज के लिए शुरुआती कॉलम की पोज़िशन दिखाता है.
getDataRegion()Rangeयह फ़ंक्शन, रेंज की एक कॉपी दिखाता है. इस कॉपी में, रेंज को चारों दिशाओं Direction में बढ़ाया जाता है, ताकि डेटा वाले सभी आस-पास के सेल शामिल किए जा सकें.
getDataRegion(dimension)Rangeअगर तय किया गया डाइमेंशन Dimension.ROWS है, तो यह फ़ंक्शन, Direction.UP और Direction.DOWN के तौर पर बड़ा किए गए रेंज की कॉपी दिखाता है. अगर डाइमेंशन Dimension.COLUMNS है, तो यह फ़ंक्शन, Direction.NEXT और Direction.PREVIOUS के तौर पर बड़ा किए गए रेंज की कॉपी दिखाता है.
getDataSourceFormula()DataSourceFormulaयह फ़ंक्शन, रेंज में मौजूद पहली सेल के लिए DataSourceFormula वैल्यू दिखाता है. अगर सेल में डेटा सोर्स का फ़ॉर्मूला नहीं है, तो यह null वैल्यू दिखाता है.
getDataSourceFormulas()DataSourceFormula[]यह फ़ंक्शन, रेंज में मौजूद सेल के लिए DataSourceFormula दिखाता है.
getDataSourcePivotTables()DataSourcePivotTable[]इस फ़ंक्शन से, रेंज में मौजूद सभी डेटा सोर्स पिवट टेबल मिलती हैं.
getDataSourceTables()DataSourceTable[]इस फ़ंक्शन से, रेंज के साथ इंटरसेक्ट करने वाली सभी डेटा सोर्स टेबल मिलती हैं.
getDataSourceUrl()Stringयह फ़ंक्शन, इस रेंज में मौजूद डेटा के लिए यूआरएल दिखाता है. इसका इस्तेमाल चार्ट और क्वेरी बनाने के लिए किया जा सकता है.
getDataTable()DataTableइस ऑब्जेक्ट में मौजूद डेटा को DataTable के तौर पर दिखाएं.
getDataTable(firstRowIsHeader)DataTableइस रेंज में मौजूद डेटा को DataTable के तौर पर दिखाओ.
getDataValidation()DataValidationयह फ़ंक्शन, रेंज में सबसे ऊपर मौजूद बाएं सेल के लिए, डेटा की पुष्टि करने का नियम दिखाता है.
getDataValidations()DataValidation[][]यह फ़ंक्शन, रेंज में मौजूद सभी सेल के लिए डेटा की पुष्टि करने के नियम दिखाता है.
getDeveloperMetadata()DeveloperMetadata[]इस रेंज से जुड़ा डेवलपर मेटाडेटा मिलता है.
getDisplayValue()Stringइस फ़ंक्शन से, रेंज में सबसे ऊपर मौजूद बाएं सेल की दिखाई गई वैल्यू मिलती है.
getDisplayValues()String[][]यह फ़ंक्शन, इस रेंज के लिए वैल्यू का आयताकार ग्रिड दिखाता है.
getFilter()Filterयह फ़ंक्शन, उस शीट पर मौजूद फ़िल्टर दिखाता है जिससे यह रेंज जुड़ी है. अगर शीट पर कोई फ़िल्टर नहीं है, तो यह null दिखाता है.
getFontColorObject()Colorयह फ़ंक्शन, रेंज के सबसे ऊपर मौजूद बाएं कोने में मौजूद सेल के फ़ॉन्ट का रंग दिखाता है.
getFontColorObjects()Color[][]इस फ़ंक्शन से, रेंज में मौजूद सेल के फ़ॉन्ट के रंग मिलते हैं.
getFontFamilies()String[][]इस फ़ंक्शन से, रेंज में मौजूद सेल की फ़ॉन्ट फ़ैमिली मिलती हैं.
getFontFamily()Stringयह विकल्प, रेंज के सबसे ऊपर मौजूद बाएं कोने में मौजूद सेल की फ़ॉन्ट फ़ैमिली दिखाता है.
getFontLine()Stringइस फ़ंक्शन से, रेंज के सबसे ऊपर बाएं कोने में मौजूद सेल ('underline', 'line-through' या 'none') की लाइन स्टाइल मिलती है.
getFontLines()String[][]इस फ़ंक्शन से, रेंज में मौजूद सेल की लाइन स्टाइल ('underline', 'line-through' या 'none') मिलती है.
getFontSize()Integerयह फ़ंक्शन, रेंज के सबसे ऊपर मौजूद बाएं कोने वाले सेल के फ़ॉन्ट का साइज़ पॉइंट में दिखाता है.
getFontSizes()Integer[][]इस फ़ंक्शन से, रेंज में मौजूद सेल के फ़ॉन्ट साइज़ मिलते हैं.
getFontStyle()Stringयह फ़ंक्शन, रेंज के सबसे ऊपर मौजूद बाएं कोने वाले सेल का फ़ॉन्ट स्टाइल ('italic' या 'normal') दिखाता है.
getFontStyles()String[][]इस फ़ंक्शन की मदद से, रेंज में मौजूद सेल के फ़ॉन्ट स्टाइल की जानकारी मिलती है.
getFontWeight()Stringयह फ़ंक्शन, रेंज के सबसे ऊपर मौजूद बाएं कोने वाले सेल के फ़ॉन्ट का वेट (सामान्य/बोल्ड) दिखाता है.
getFontWeights()String[][]यह फ़ंक्शन, रेंज में मौजूद सेल के फ़ॉन्ट वेट दिखाता है.
getFormula()Stringयह फ़ंक्शन, रेंज की सबसे ऊपर बाईं ओर मौजूद सेल के लिए फ़ॉर्मूला (A1 नोटेशन) दिखाता है. अगर सेल खाली है या उसमें कोई फ़ॉर्मूला नहीं है, तो यह फ़ंक्शन एक खाली स्ट्रिंग दिखाता है.
getFormulaR1C1()Stringकिसी सेल के लिए फ़ॉर्मूला (R1C1 नोटेशन) दिखाता है. अगर कोई फ़ॉर्मूला नहीं है, तो null दिखाता है.
getFormulas()String[][]यह फ़ंक्शन, रेंज में मौजूद सेल के लिए फ़ॉर्मूले (A1 नोटेशन) दिखाता है.
getFormulasR1C1()String[][]यह फ़ंक्शन, रेंज में मौजूद सेल के लिए फ़ॉर्मूले (R1C1 नोटेशन) दिखाता है.
getGridId()Integerयह फ़ंक्शन, रेंज की पैरंट शीट का ग्रिड आईडी दिखाता है.
getHeight()Integerयह फ़ंक्शन, रेंज की ऊंचाई दिखाता है.
getHorizontalAlignment()Stringयह फ़ंक्शन, रेंज के सबसे ऊपर बाएं कोने में मौजूद सेल के टेक्स्ट का हॉरिज़ॉन्टल अलाइनमेंट (बाएं/बीच/दाएं) दिखाता है.
getHorizontalAlignments()String[][]यह फ़ंक्शन, रेंज में मौजूद सेल के हॉरिज़ॉन्टल अलाइनमेंट दिखाता है.
getLastColumn()Integerयह फ़ंक्शन, आखिरी कॉलम की पोज़िशन दिखाता है.
getLastRow()Integerआखिरी लाइन की पोज़िशन दिखाता है.
getMergedRanges()Range[]यह फ़ंक्शन, Range ऑब्जेक्ट की एक ऐसी कलेक्शन दिखाता है जिसमें मर्ज की गई सेल शामिल होती हैं. ये सेल या तो पूरी तरह से मौजूदा रेंज में होती हैं या इनमें से कम से कम एक सेल मौजूदा रेंज में होती है.
getNextDataCell(direction)Rangeयह फ़ंक्शन, रेंज के पहले कॉलम और पहली लाइन में मौजूद सेल से शुरू होकर, दी गई दिशा में मौजूद अगली सेल दिखाता है. यह सेल, डेटा वाली सेल की लगातार रेंज का किनारा होती है या उस दिशा में स्प्रेडशीट के किनारे पर मौजूद सेल होती है.
getNote()Stringयह फ़ंक्शन, दी गई रेंज से जुड़ा नोट दिखाता है.
getNotes()String[][]यह फ़ंक्शन, रेंज में मौजूद सेल से जुड़े नोट दिखाता है.
getNumColumns()Integerयह फ़ंक्शन, इस रेंज में मौजूद कॉलम की संख्या दिखाता है.
getNumRows()Integerयह फ़ंक्शन, इस रेंज में मौजूद पंक्तियों की संख्या दिखाता है.
getNumberFormat()Stringइस फ़ंक्शन की मदद से, दी गई रेंज की सबसे ऊपर बाईं ओर मौजूद सेल की संख्या या तारीख की फ़ॉर्मैटिंग मिलती है.
getNumberFormats()String[][]यह फ़ंक्शन, रेंज में मौजूद सेल के लिए संख्या या तारीख के फ़ॉर्मैट दिखाता है.
getRichTextValue()RichTextValueयह फ़ंक्शन, रेंज की सबसे ऊपर बाईं ओर मौजूद सेल के लिए रिच टेक्स्ट वैल्यू दिखाता है. अगर सेल की वैल्यू टेक्स्ट नहीं है, तो यह null दिखाता है.
getRichTextValues()RichTextValue[][]यह फ़ंक्शन, रेंज में मौजूद सेल के लिए रिच टेक्स्ट वैल्यू दिखाता है.
getRow()Integerयह फ़ंक्शन, इस रेंज के लिए लाइन की पोज़िशन दिखाता है.
getRowIndex()Integerयह फ़ंक्शन, इस रेंज के लिए लाइन की पोज़िशन दिखाता है.
getSheet()Sheetयह फ़ंक्शन, उस शीट को दिखाता है जिससे यह रेंज जुड़ी है.
getTextDirection()TextDirectionयह फ़ंक्शन, रेंज के सबसे ऊपर मौजूद बाएं सेल के लिए टेक्स्ट की दिशा दिखाता है.
getTextDirections()TextDirection[][]इस फ़ंक्शन की मदद से, रेंज में मौजूद सेल के लिए टेक्स्ट की दिशाएं मिलती हैं.
getTextRotation()TextRotationयह फ़ंक्शन, रेंज में मौजूद सबसे ऊपर बाईं ओर वाले सेल के लिए, टेक्स्ट रोटेशन की सेटिंग दिखाता है.
getTextRotations()TextRotation[][]इस फ़ंक्शन की मदद से, रेंज में मौजूद सेल के लिए टेक्स्ट रोटेशन की सेटिंग मिलती हैं.
getTextStyle()TextStyleयह फ़ंक्शन, रेंज के सबसे ऊपर मौजूद बाएं सेल के लिए टेक्स्ट स्टाइल दिखाता है.
getTextStyles()TextStyle[][]इस फ़ंक्शन की मदद से, रेंज में मौजूद सेल के लिए टेक्स्ट स्टाइल मिलती हैं.
getValue()Objectयह फ़ंक्शन, रेंज में सबसे ऊपर मौजूद बाएं सेल की वैल्यू दिखाता है.
getValues()Object[][]यह फ़ंक्शन, इस रेंज के लिए वैल्यू का आयताकार ग्रिड दिखाता है.
getVerticalAlignment()Stringयह फ़ंक्शन, रेंज के सबसे ऊपर मौजूद बाएं कोने वाली सेल का वर्टिकल अलाइनमेंट (सबसे ऊपर/बीच में/सबसे नीचे) दिखाता है.
getVerticalAlignments()String[][]यह फ़ंक्शन, रेंज में मौजूद सेल के वर्टिकल अलाइनमेंट दिखाता है.
getWidth()Integerयह फ़ंक्शन, कॉलम में मौजूद रेंज की चौड़ाई दिखाता है.
getWrap()Booleanइससे यह पता चलता है कि सेल में मौजूद टेक्स्ट रैप होता है या नहीं.
getWrapStrategies()WrapStrategy[][]इस फ़ंक्शन की मदद से, रेंज में मौजूद सेल के लिए टेक्स्ट रैपिंग की रणनीतियां मिलती हैं.
getWrapStrategy()WrapStrategyयह फ़ंक्शन, रेंज में सबसे ऊपर मौजूद बाएं सेल के लिए, टेक्स्ट रैपिंग की रणनीति दिखाता है.
getWraps()Boolean[][]इससे यह पता चलता है कि सेल में मौजूद टेक्स्ट रैप होता है या नहीं.
insertCells(shiftDimension)Rangeइस रेंज में खाली सेल शामिल करता है.
insertCheckboxes()Rangeयह फ़ंक्शन, रेंज की हर सेल में चेकबॉक्स डालता है. इसमें true को चुने गए और false को नहीं चुने गए के तौर पर कॉन्फ़िगर किया जाता है.
insertCheckboxes(checkedValue)Rangeयह फ़ंक्शन, रेंज की हर सेल में चेकबॉक्स डालता है. इसमें, चुने गए चेकबॉक्स के लिए कस्टम वैल्यू और न चुने गए चेकबॉक्स के लिए खाली स्ट्रिंग कॉन्फ़िगर की जाती है.
insertCheckboxes(checkedValue, uncheckedValue)Rangeयह फ़ंक्शन, रेंज की हर सेल में चेकबॉक्स डालता है. इन चेकबॉक्स को, चुने गए और नहीं चुने गए स्टेटस के लिए कस्टम वैल्यू के साथ कॉन्फ़िगर किया जाता है.
isBlank()Booleanअगर रेंज पूरी तरह से खाली है, तो true दिखाता है.
isChecked()Booleanयह फ़ंक्शन बताता है कि रेंज में मौजूद सभी सेल में चेकबॉक्स की स्थिति 'चुना गया' के तौर पर सेट है या नहीं.
isEndColumnBounded()Booleanइससे यह तय होता है कि रेंज का आखिरी हिस्सा किसी कॉलम से जुड़ा है या नहीं.
isEndRowBounded()Booleanइससे यह तय होता है कि रेंज का आखिरी हिस्सा किसी खास लाइन से जुड़ा है या नहीं.
isPartOfMerge()Booleanअगर मौजूदा रेंज में मौजूद सेल, मर्ज की गई किसी सेल से ओवरलैप होती हैं, तो true दिखाता है.
isStartColumnBounded()Booleanइस विकल्प से यह तय होता है कि रेंज की शुरुआत किसी कॉलम से बंधी है या नहीं.
isStartRowBounded()Booleanइससे यह तय होता है कि रेंज की शुरुआत किसी खास लाइन से जुड़ी है या नहीं.
merge()Rangeयह फ़ंक्शन, रेंज में मौजूद सेल को एक साथ मिलाकर एक ब्लॉक बना देता है.
mergeAcross()Rangeरेंज के कॉलम में मौजूद सेल को मर्ज करता है.
mergeVertically()Rangeयह फ़ंक्शन, रेंज में मौजूद सेल को एक साथ मर्ज करता है.
moveTo(target)voidइस रेंज से टारगेट रेंज में, कट और चिपकाएं. इसमें फ़ॉर्मैट और वैल्यू, दोनों शामिल हैं.
offset(rowOffset, columnOffset)Rangeयह फ़ंक्शन, एक नई रेंज दिखाता है. यह रेंज, दी गई पंक्तियों और कॉलम की संख्या के हिसाब से इस रेंज से ऑफ़सेट होती है. पंक्तियों और कॉलम की संख्या नेगेटिव भी हो सकती है.
offset(rowOffset, columnOffset, numRows)Rangeयह फ़ंक्शन, मौजूदा रेंज के हिसाब से एक नई रेंज दिखाता है. इस नई रेंज का सबसे ऊपर मौजूद बायां पॉइंट, मौजूदा रेंज से दी गई पंक्तियों और कॉलम के हिसाब से ऑफ़सेट होता है. साथ ही, इसकी ऊंचाई, सेल में दी गई ऊंचाई के बराबर होती है.
offset(rowOffset, columnOffset, numRows, numColumns)Rangeयह फ़ंक्शन, मौजूदा रेंज के हिसाब से एक नई रेंज दिखाता है. इस नई रेंज का ऊपरी-बायां कोना, मौजूदा रेंज के ऊपरी-बाएं कोने से दी गई पंक्तियों और कॉलम की संख्या के हिसाब से ऑफ़सेट होता है. साथ ही, इसकी ऊंचाई और चौड़ाई, सेल में दी गई ऊंचाई और चौड़ाई के बराबर होती है.
protect()Protectionयह एक ऐसा ऑब्जेक्ट बनाता है जो रेंज को उन उपयोगकर्ताओं के अलावा किसी और से बदलाव करने से सुरक्षित रख सकता है जिनके पास अनुमति है.
randomize()Rangeयह फ़ंक्शन, दी गई रेंज में मौजूद पंक्तियों के क्रम को बदल देता है.
removeCheckboxes()Rangeइस फ़ंक्शन की मदद से, रेंज से सभी चेकबॉक्स हटाए जाते हैं.
removeDuplicates()Rangeइस रेंज में मौजूद उन लाइनों को हटाता है जिनमें ऐसी वैल्यू होती हैं जो किसी पिछली लाइन में मौजूद वैल्यू की डुप्लीकेट होती हैं.
removeDuplicates(columnsToCompare)Rangeइस रेंज में मौजूद उन लाइनों को हटाता है जिनमें डुप्लीकेट वैल्यू होती हैं. डुप्लीकेट वैल्यू, पहले की किसी लाइन में मौजूद वैल्यू की डुप्लीकेट होती हैं.
setBackground(color)Rangeइस विकल्प से, सीएसएस नोटेशन में रेंज की सभी सेल के बैकग्राउंड का रंग सेट किया जाता है. जैसे, '#ffffff' या 'white'.
setBackgroundObject(color)Rangeइस विकल्प का इस्तेमाल करके, रेंज में मौजूद सभी सेल के बैकग्राउंड का रंग सेट किया जाता है.
setBackgroundObjects(color)Rangeबैकग्राउंड के रंगों की आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए.
setBackgroundRGB(red, green, blue)Rangeइस विकल्प का इस्तेमाल करके, आरजीबी वैल्यू (0 से 255 के बीच के पूर्णांक) का इस्तेमाल करके, बैकग्राउंड को दिए गए रंग पर सेट किया जाता है.
setBackgrounds(color)Rangeबैकग्राउंड के रंगों की आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए.
setBorder(top, left, bottom, right, vertical, horizontal)Rangeबॉर्डर प्रॉपर्टी सेट करता है.
setBorder(top, left, bottom, right, vertical, horizontal, color, style)Rangeइस विकल्प की मदद से, बॉर्डर की प्रॉपर्टी को रंग और/या स्टाइल के साथ सेट किया जाता है.
setDataValidation(rule)Rangeयह फ़ंक्शन, रेंज में मौजूद सभी सेल के लिए डेटा की पुष्टि करने का एक नियम सेट करता है.
setDataValidations(rules)Rangeयह फ़ंक्शन, रेंज में मौजूद सभी सेल के लिए डेटा की पुष्टि करने के नियम सेट करता है.
setFontColor(color)Rangeइससे सीएसएस नोटेशन (जैसे कि '#ffffff' या 'white') में फ़ॉन्ट का रंग सेट किया जाता है.
setFontColorObject(color)Rangeइससे दी गई रेंज के फ़ॉन्ट का रंग सेट किया जाता है.
setFontColorObjects(colors)Rangeयह फ़ॉन्ट के रंगों की आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए.
setFontColors(colors)Rangeयह फ़ॉन्ट के रंगों की आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए.
setFontFamilies(fontFamilies)Rangeइससे फ़ॉन्ट फ़ैमिली की आयताकार ग्रिड सेट की जाती है. यह इस रेंज के डाइमेंशन से मेल खानी चाहिए.
setFontFamily(fontFamily)Rangeइससे फ़ॉन्ट फ़ैमिली सेट की जाती है. जैसे, "Arial" या "Helvetica".
setFontLine(fontLine)Rangeयह दिए गए रेंज ('underline', 'line-through' या 'none') के फ़ॉन्ट की लाइन स्टाइल सेट करता है.
setFontLines(fontLines)Rangeलाइन स्टाइल की रेक्टैंगुलर ग्रिड सेट करता है. यह इस रेंज के डाइमेंशन से मेल खानी चाहिए.
setFontSize(size)Rangeइससे फ़ॉन्ट का साइज़ सेट किया जाता है. साइज़, इस्तेमाल किया जाने वाला पॉइंट साइज़ होता है.
setFontSizes(sizes)Rangeइससे फ़ॉन्ट साइज़ की आयताकार ग्रिड सेट की जाती है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए.
setFontStyle(fontStyle)Rangeदी गई रेंज ('italic' या 'normal') के लिए फ़ॉन्ट स्टाइल सेट करें.
setFontStyles(fontStyles)Rangeइससे फ़ॉन्ट स्टाइल की आयताकार ग्रिड सेट की जाती है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए.
setFontWeight(fontWeight)Rangeदी गई रेंज के लिए फ़ॉन्ट वेट (सामान्य/बोल्ड) सेट करता है.
setFontWeights(fontWeights)Rangeइससे फ़ॉन्ट वेट की रेक्टैंगुलर ग्रिड सेट की जाती है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए.
setFormula(formula)Rangeइस रेंज के लिए फ़ॉर्मूला अपडेट करता है.
setFormulaR1C1(formula)Rangeइस रेंज के लिए फ़ॉर्मूला अपडेट करता है.
setFormulas(formulas)Rangeफ़ॉर्मूलों की आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए.
setFormulasR1C1(formulas)Rangeफ़ॉर्मूलों की आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए.
setHorizontalAlignment(alignment)Rangeदी गई रेंज के लिए, हॉरिज़ॉन्टल (बाएं से दाएं) अलाइनमेंट (बाएं/बीच/दाएं) सेट करता है.
setHorizontalAlignments(alignments)Rangeहॉरिज़ॉन्टल अलाइनमेंट की आयताकार ग्रिड सेट करता है.
setNote(note)Rangeनोट को दी गई वैल्यू पर सेट करता है.
setNotes(notes)Rangeनोट की आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए.
setNumberFormat(numberFormat)Rangeयह फ़ंक्शन, फ़ॉर्मैटिंग स्ट्रिंग के हिसाब से नंबर या तारीख का फ़ॉर्मैट सेट करता है.
setNumberFormats(numberFormats)Rangeयह फ़ंक्शन, संख्याओं या तारीखों के फ़ॉर्मैट की आयताकार ग्रिड सेट करता है. यह ज़रूरी है कि यह ग्रिड, इस रेंज के डाइमेंशन से मेल खाती हो.
setRichTextValue(value)Rangeइस फ़ंक्शन का इस्तेमाल करके, रेंज में मौजूद सेल के लिए रिच टेक्स्ट वैल्यू सेट की जाती है.
setRichTextValues(values)Rangeइससे रिच टेक्स्ट वैल्यू की आयताकार ग्रिड सेट की जाती है.
setShowHyperlink(showHyperlink)Rangeइससे यह सेट होता है कि रेंज में हाइपरलिंक दिखने चाहिए या नहीं.
setTextDirection(direction)Rangeइस विकल्प से, रेंज में मौजूद सेल के लिए टेक्स्ट की दिशा सेट की जाती है.
setTextDirections(directions)Rangeइससे टेक्स्ट की दिशाओं का आयताकार ग्रिड सेट किया जाता है.
setTextRotation(degrees)Rangeइस विकल्प से, रेंज में मौजूद सेल के लिए टेक्स्ट रोटेशन की सेटिंग सेट की जाती हैं.
setTextRotation(rotation)Rangeइस विकल्प से, रेंज में मौजूद सेल के लिए टेक्स्ट रोटेशन की सेटिंग सेट की जाती हैं.
setTextRotations(rotations)Rangeइससे टेक्स्ट रोटेशन की आयताकार ग्रिड सेट की जाती है.
setTextStyle(style)Rangeइस विकल्प से, रेंज में मौजूद सेल के लिए टेक्स्ट स्टाइल सेट की जाती है.
setTextStyles(styles)Rangeइससे टेक्स्ट स्टाइल का आयताकार ग्रिड सेट किया जाता है.
setValue(value)Rangeइस विकल्प का इस्तेमाल करके, रेंज की वैल्यू सेट की जाती है.
setValues(values)Rangeवैल्यू की आयताकार ग्रिड सेट करता है. यह इस रेंज के डाइमेंशन से मेल खानी चाहिए.
setVerticalAlignment(alignment)Rangeदी गई रेंज के लिए, वर्टिकल (ऊपर से नीचे) अलाइनमेंट सेट करें (ऊपर/बीच में/नीचे).
setVerticalAlignments(alignments)Rangeवर्टिकल अलाइनमेंट की आयताकार ग्रिड सेट करता है. यह इस रेंज के डाइमेंशन से मेल खानी चाहिए.
setVerticalText(isVertical)Rangeइस विकल्प से यह सेट किया जाता है कि रेंज में मौजूद सेल के टेक्स्ट को स्टैक करना है या नहीं.
setWrap(isWrapEnabled)Rangeइस फ़ंक्शन का इस्तेमाल करके, दी गई रेंज के सेल रैप को सेट किया जाता है.
setWrapStrategies(strategies)Rangeयह रैप करने की रणनीतियों की रेक्टैंगुलर ग्रिड सेट करता है.
setWrapStrategy(strategy)Rangeइस विकल्प से, रेंज में मौजूद सेल के लिए टेक्स्ट रैपिंग की रणनीति सेट की जाती है.
setWraps(isWrapEnabled)Rangeइससे टेक्स्ट रैप करने की नीतियों की रेक्टैंगल ग्रिड सेट की जाती है. यह इस रेंज के डाइमेंशन से मेल खानी चाहिए.
shiftColumnGroupDepth(delta)Rangeयह फ़ंक्शन, तय की गई रकम के हिसाब से रेंज के कॉलम ग्रुपिंग की डेप्थ को बदलता है.
shiftRowGroupDepth(delta)Rangeयह फ़ंक्शन, तय की गई रकम के हिसाब से रेंज की लाइन ग्रुपिंग की डेप्थ बदलता है.
sort(sortSpecObj)Rangeयह फ़ंक्शन, दी गई रेंज में मौजूद सेल को तय किए गए कॉलम और क्रम के हिसाब से क्रम से लगाता है.
splitTextToColumns()voidयह फ़ंक्शन, टेक्स्ट वाले कॉलम को कई कॉलम में बांटता है. इसके लिए, यह अपने-आप पता लगाए गए डेलिमिटर का इस्तेमाल करता है.
splitTextToColumns(delimiter)voidइस फ़ंक्शन की मदद से, टेक्स्ट के किसी कॉलम को कई कॉलम में बांटा जा सकता है. इसके लिए, कस्टम डेलिमिटर के तौर पर तय की गई स्ट्रिंग का इस्तेमाल किया जाता है.
splitTextToColumns(delimiter)voidयह फ़ंक्शन, टेक्स्ट वाले कॉलम को तय किए गए डेलिमिटर के आधार पर कई कॉलम में बांटता है.
trimWhitespace()Rangeयह फ़ंक्शन, इस रेंज की हर सेल में मौजूद खाली जगह (जैसे कि स्पेस, टैब या नई लाइनें) को हटाता है.
uncheck()Rangeइस फ़ंक्शन की मदद से, रेंज में मौजूद चेकबॉक्स की स्थिति को “unchecked” में बदला जा सकता है.

ज़्यादा जानकारी वाला दस्तावेज़

activate()

यह फ़ंक्शन, तय की गई रेंज को active range के तौर पर सेट करता है. साथ ही, रेंज में सबसे ऊपर बाईं ओर मौजूद सेल को current cell के तौर पर सेट करता है.

const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
const range = sheet.getRange('A1:D10');
range.activate();

const selection = sheet.getSelection();
// Current cell: A1
const currentCell = selection.getCurrentCell();
// Active Range: A1:D10
const activeRange = selection.getActiveRange();

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.


activateAsCurrentCell()

इस फ़ंक्शन से, तय की गई सेल को current cell के तौर पर सेट किया जाता है.

अगर बताई गई सेल, किसी मौजूदा रेंज में मौजूद है, तो वह रेंज, मौजूदा सेल के साथ ऐक्टिव रेंज बन जाती है.

अगर बताई गई सेल किसी मौजूदा रेंज में मौजूद नहीं है, तो मौजूदा सिलेक्शन हटा दिया जाता है. साथ ही, सेल मौजूदा सेल और ऐक्टिव रेंज बन जाती है.

ध्यान दें: बताया गया Range एक सेल का होना चाहिए. ऐसा न होने पर, यह फ़ंक्शन एक अपवाद दिखाता है.

// Gets the first sheet of the spreadsheet.
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];

// Gets the cell B5 and sets it as the active cell.
const range = sheet.getRange('B5');
const currentCell = range.activateAsCurrentCell();

// Logs the activated cell.
console.log(currentCell.getA1Notation());

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

addDeveloperMetadata(key)

यह फ़ंक्शन, रेंज में दी गई कुंजी के साथ डेवलपर मेटाडेटा जोड़ता है.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets row 2 on the sheet.
const range = sheet.getRange('2:2');

// Adds the key 'NAME' to the developer metadata for row 2.
range.addDeveloperMetadata('NAME');

// Gets the metadata and logs it to the console.
const developerMetaData = range.getDeveloperMetadata()[0];
console.log(developerMetaData.getKey());

पैरामीटर

नामटाइपब्यौरा
keyStringनए डेवलपर मेटाडेटा के लिए कुंजी.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

addDeveloperMetadata(key, visibility)

यह फ़ंक्शन, रेंज में डेवलपर मेटाडेटा जोड़ता है. इसमें तय की गई कुंजी और दृश्यता होती है.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets row 2 on Sheet1.
const range = sheet.getRange('2:2');

// Adds the key 'NAME' and sets the developer metadata visibility to 'DOCUMENT'
// for row 2 on Sheet1.
range.addDeveloperMetadata(
    'NAME',
    SpreadsheetApp.DeveloperMetadataVisibility.DOCUMENT,
);

// Gets the updated metadata info and logs it to the console.
const developerMetaData = range.getDeveloperMetadata()[0];
console.log(developerMetaData.getKey());
console.log(developerMetaData.getVisibility().toString());

पैरामीटर

नामटाइपब्यौरा
keyStringनए डेवलपर मेटाडेटा के लिए कुंजी.
visibilityDeveloperMetadataVisibilityनए डेवलपर मेटाडेटा के दिखने की स्थिति.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

addDeveloperMetadata(key, value)

यह फ़ंक्शन, रेंज में डेवलपर मेटाडेटा जोड़ता है. इसमें तय की गई कुंजी और वैल्यू शामिल होती है.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets row 2 of Sheet1.
const range = sheet.getRange('2:2');

// Adds the key 'NAME' and sets the value to 'GOOGLE' for the metadata of row 2.
range.addDeveloperMetadata('NAME', 'GOOGLE');

// Gets the metadata and logs it to the console.
const developerMetaData = range.getDeveloperMetadata()[0];
console.log(developerMetaData.getKey());
console.log(developerMetaData.getValue());

पैरामीटर

नामटाइपब्यौरा
keyStringनए डेवलपर मेटाडेटा के लिए कुंजी.
valueStringनए डेवलपर मेटाडेटा की वैल्यू.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

addDeveloperMetadata(key, value, visibility)

यह फ़ंक्शन, रेंज में डेवलपर मेटाडेटा जोड़ता है. इसके लिए, तय की गई कुंजी, वैल्यू, और दिखने की सेटिंग का इस्तेमाल किया जाता है.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets row 2 on the sheet.
const range = sheet.getRange('2:2');

// Adds the key 'NAME', sets the value to 'GOOGLE', and sets the visibility
// to PROJECT for row 2 on the sheet.
range.addDeveloperMetadata(
    'NAME',
    'GOOGLE',
    SpreadsheetApp.DeveloperMetadataVisibility.PROJECT,
);

// Gets the updated metadata info and logs it to the console.
const developerMetaData = range.getDeveloperMetadata()[0];
console.log(developerMetaData.getKey());
console.log(developerMetaData.getValue());
console.log(developerMetaData.getVisibility().toString());

पैरामीटर

नामटाइपब्यौरा
keyStringनए डेवलपर मेटाडेटा के लिए कुंजी.
valueStringनए डेवलपर मेटाडेटा की वैल्यू.
visibilityDeveloperMetadataVisibilityनए डेवलपर मेटाडेटा के दिखने की स्थिति.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

applyColumnBanding()

इस फ़ंक्शन की मदद से, रेंज में डिफ़ॉल्ट कॉलम बैंडिंग थीम लागू की जाती है. डिफ़ॉल्ट रूप से, बैंडिंग में हेडर का रंग होता है और फ़ुटर का रंग नहीं होता.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets row 2 on the sheet.
const range = sheet.getRange('2:2');

// Applies column banding to row 2.
const colBanding = range.applyColumnBanding();

// Gets the first banding on the sheet and logs the color of the header column.
console.log(
    sheet.getBandings()[0]
        .getHeaderColumnColorObject()
        .asRgbColor()
        .asHexString(),
);

// Gets the first banding on the sheet and logs the color of the second column.
console.log(
    sheet.getBandings()[0]
        .getSecondColumnColorObject()
        .asRgbColor()
        .asHexString(),
);

वापसी का टिकट

Banding — नई बैंडिंग.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

applyColumnBanding(bandingTheme)

यह फ़ंक्शन, रेंज में कॉलम बैंडिंग की तय की गई थीम लागू करता है. डिफ़ॉल्ट रूप से, बैंडिंग में हेडर होता है और फ़ुटर का रंग नहीं होता.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets row 2 on the sheet.
const range = sheet.getRange('2:2');

// Applies the INDIGO color banding theme to the columns in row 2.
const colBanding = range.applyColumnBanding(SpreadsheetApp.BandingTheme.INDIGO);

// Gets the first banding on the sheet and logs the color of the second column.
console.log(
    sheet.getBandings()[0]
        .getSecondColumnColorObject()
        .asRgbColor()
        .asHexString(),
);

पैरामीटर

नामटाइपब्यौरा
bandingThemeBandingThemeरेंज में मौजूद कॉलम पर लागू करने के लिए, रंग की थीम.

वापसी का टिकट

Banding — नई बैंडिंग.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

applyColumnBanding(bandingTheme, showHeader, showFooter)

यह फ़ंक्शन, हेडर और फ़ुटर की सेटिंग के साथ-साथ तय की गई रेंज में, कॉलम बैंडिंग की थीम लागू करता है.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets rows 12-22 on the sheet.
const range = sheet.getRange('12:22');

// Applies the BLUE color banding theme to rows 12-22.
// Sets the header visibility to false and the footer visibility to true.
const colBanding = range.applyColumnBanding(
    SpreadsheetApp.BandingTheme.BLUE,
    false,
    true,
);

// Gets the banding color and logs it to the console.
console.log(
    sheet.getBandings()[0]
        .getSecondColumnColorObject()
        .asRgbColor()
        .asHexString(),
);

// Gets the header color object and logs it to the console. Returns null because
// the header visibility is set to false.
console.log(sheet.getBandings()[0].getHeaderColumnColorObject());

// Gets the footer color and logs it to the console.
console.log(
    sheet.getBandings()[0]
        .getFooterColumnColorObject()
        .asRgbColor()
        .asHexString(),
);

पैरामीटर

नामटाइपब्यौरा
bandingThemeBandingThemeरेंज में मौजूद कॉलम पर लागू करने के लिए, रंग की थीम.
showHeaderBooleanअगर true है, तो बैंडिंग थीम के हेडर का रंग, पहले कॉलम पर लागू होता है.
showFooterBooleanअगर true है, तो बैंडिंग थीम के फ़ुटर का रंग, आखिरी कॉलम पर लागू होता है.

वापसी का टिकट

Banding — नई बैंडिंग.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

applyRowBanding()

यह फ़ंक्शन, रेंज में लाइन के रंग को बदलने वाली डिफ़ॉल्ट थीम लागू करता है. डिफ़ॉल्ट रूप से, बैंडिंग में हेडर का रंग होता है और फ़ुटर का रंग नहीं होता.

// Opens the spreadsheet by its URL. If you created your script from within a
// Google Sheets spreadsheet, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets rows 1-30 on Sheet1.
const range = sheet.getRange('1:30');

// Applies row banding to rows 1-30.
range.applyRowBanding();

// Gets the hex color of the second banded row.
const secondRowColor =
    range.getBandings()[0].getSecondRowColorObject().asRgbColor().asHexString();

// Logs the hex color to console.
console.log(secondRowColor);

वापसी का टिकट

Banding — बैंडिंग.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

applyRowBanding(bandingTheme)

यह फ़ंक्शन, रेंज में लाइन के रंग वाली थीम लागू करता है. डिफ़ॉल्ट रूप से, बैंडिंग में हेडर का रंग होता है और फ़ुटर का रंग नहीं होता.

// Opens the spreadsheet by its URL. If you created your script from within a
// Google Sheets spreadsheet, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets rows 1-30 on Sheet1.
const range = sheet.getRange('1:30');

// Applies the INDIGO row banding theme to rows 1-30.
range.applyRowBanding(SpreadsheetApp.BandingTheme.INDIGO);

// Gets the hex color of the second banded row.
const secondRowColor =
    range.getBandings()[0].getSecondRowColorObject().asRgbColor().asHexString();

// Logs the hex color to console.
console.log(secondRowColor);

पैरामीटर

नामटाइपब्यौरा
bandingThemeBandingThemeरंग की थीम, जिसे रेंज में मौजूद लाइनों पर लागू करना है.

वापसी का टिकट

Banding — नई बैंडिंग.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

applyRowBanding(bandingTheme, showHeader, showFooter)

यह फ़ंक्शन, हेडर और फ़ुटर की दी गई सेटिंग के साथ, तय की गई रेंज में लाइनें डालने की थीम लागू करता है.

// Opens the spreadsheet by its URL. If you created your script from within a
// Google Sheets spreadsheet, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets rows 1-30 on Sheet1.
const range = sheet.getRange('1:30');

// Applies the INDIGO row banding to rows 1-30 and
// specifies to hide the header and show the footer.
range.applyRowBanding(SpreadsheetApp.BandingTheme.INDIGO, false, true);

पैरामीटर

नामटाइपब्यौरा
bandingThemeBandingThemeरंग की थीम, जिसे रेंज में मौजूद लाइनों पर लागू करना है.
showHeaderBooleanअगर true है, तो बैंडिंग थीम के हेडर का रंग पहली लाइन पर लागू होता है.
showFooterBooleanअगर true है, तो बैंडिंग थीम के फ़ुटर का रंग, आखिरी लाइन पर लागू होता है.

वापसी का टिकट

Banding — नई बैंडिंग.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

autoFill(destination, series)

इस रेंज में मौजूद डेटा के आधार पर, destinationRange में डेटा भरता है. नई वैल्यू भी, तय किए गए series टाइप के हिसाब से तय की जाती हैं. डेस्टिनेशन रेंज में यह रेंज शामिल होनी चाहिए. साथ ही, इसे सिर्फ़ एक दिशा में बढ़ाया जाना चाहिए. उदाहरण के लिए, यहां A1:A20 में मौजूद मौजूदा वैल्यू के आधार पर, A1:A4 में बढ़ती हुई संख्याओं की सीरीज़ भरी जाती है:

const sheet = SpreadsheetApp.getActiveSheet();

// Has values [1, 2, 3, 4].
const sourceRange = sheet.getRange('A1:A4');
// The range to fill with values.
const destination = sheet.getRange('A1:A20');

// Inserts new values in A5:A20, continuing the pattern expressed in A1:A4
sourceRange.autoFill(destination, SpreadsheetApp.AutoFillSeries.DEFAULT_SERIES);

पैरामीटर

नामटाइपब्यौरा
destinationRangeवह रेंज जिसमें वैल्यू अपने-आप भरनी हैं. डेस्टिनेशन रेंज में यह रेंज शामिल होनी चाहिए. साथ ही, इसे सिर्फ़ एक दिशा में बढ़ाया जाना चाहिए (ऊपर, नीचे, बाएं या दाएं).
seriesAutoFillSeriesऑटोमैटिक भरने की सुविधा वाली सीरीज़ का वह टाइप जिसका इस्तेमाल नई वैल्यू का हिसाब लगाने के लिए किया जाना चाहिए. इस सीरीज़ का असर, सोर्स डेटा के टाइप और उसकी मात्रा के आधार पर अलग-अलग होता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

autoFillToNeighbor(series)

यह आस-पास की सेल के आधार पर, नई वैल्यू भरने के लिए एक रेंज का हिसाब लगाता है. साथ ही, इस रेंज में मौजूद डेटा के आधार पर, नई वैल्यू अपने-आप भर देता है. इन नई वैल्यू को भी, बताई गई series टाइप के हिसाब से तय किया जाता है.

डेस्टिनेशन रेंज का हिसाब लगाते समय, आस-पास के डेटा को ध्यान में रखा जाता है. इससे यह तय किया जाता है कि नई वैल्यू कहां डाली जानी चाहिए: अगर अपने-आप भरने वाले कॉलम के ठीक बाईं या दाईं ओर कोई डेटा मौजूद है, तो नई वैल्यू सिर्फ़ इस आस-पास के डेटा तक ही बढ़ाई जाती हैं.

उदाहरण के लिए, अगर A1:A20 में बढ़ती हुई संख्याओं की सीरीज़ भरी गई है और इस तरीके को B1:B4 रेंज पर कॉल किया जाता है, जिसमें तारीखों की सीरीज़ शामिल है, तो नई वैल्यू सिर्फ़ B5:B20 में डाली जाती हैं. इस तरह, ये नई वैल्यू उन सेल से "जुड़ जाती हैं" जिनमें कॉलम A में वैल्यू मौजूद होती हैं.

const sheet = SpreadsheetApp.getActiveSheet();

// A1:A20 has values [1, 2, 3, ... 20].
// B1:B4 has values [1/1/2017, 1/2/2017, ...]
const sourceRange = sheet.getRange('B1:B4');

// Results in B5:B20 having values [1/5/2017, ... 1/20/2017]
sourceRange.autoFillToNeighbor(SpreadsheetApp.AutoFillSeries.DEFAULT_SERIES);

पैरामीटर

नामटाइपब्यौरा
seriesAutoFillSeriesऑटोमैटिक भरने की सुविधा वाली सीरीज़ का वह टाइप जिसका इस्तेमाल नई वैल्यू का हिसाब लगाने के लिए किया जाना चाहिए. इस सीरीज़ का असर, सोर्स डेटा के टाइप और उसकी मात्रा के आधार पर अलग-अलग होता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

breakApart()

रेंज में मौजूद एक से ज़्यादा कॉलम वाली किसी भी सेल को फिर से अलग-अलग सेल में बांटें.

किसी रेंज पर इस फ़ंक्शन को कॉल करने का मतलब है कि आपने कोई रेंज चुनी है और फ़ॉर्मैट करें > सेल मर्ज करें > अनमर्ज करें पर क्लिक किया है.

// Opens the spreadsheet by its URL. If you created your script from within a
// Google Sheets spreadsheet, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets the range A1:C6 on Sheet1.
const range = sheet.getRange('A1:C6');

// Unmerges the range A1:C6 into individual cells.
range.breakApart();

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

canEdit()

इस कुकी से यह तय होता है कि उपयोगकर्ता के पास रेंज में मौजूद हर सेल में बदलाव करने की अनुमति है या नहीं. स्प्रेडशीट का मालिक, सुरक्षित की गई रेंज और शीट में हमेशा बदलाव कर सकता है.

// Opens the spreadsheet by its URL. If you created your script from within a
// Google Sheets spreadsheet, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets the range A1:C6 on Sheet1.
const range = sheet.getRange('A1:C6');

// Logs whether the user has permission to edit every cell in the range.
console.log(range.canEdit());

वापसी का टिकट

Booleantrue अगर उपयोगकर्ता के पास रेंज में मौजूद हर सेल में बदलाव करने की अनुमति है; false अन्यथा.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

check()

यह फ़ंक्शन, रेंज में मौजूद चेकबॉक्स की स्थिति को “चुना गया” में बदलता है. यह रेंज में मौजूद उन सेल को अनदेखा करता है जिनमें फ़िलहाल, चुने गए या नहीं चुने गए कॉन्फ़िगर किए गए मान शामिल नहीं हैं.

// Changes the state of cells which currently contain either the checked or
// unchecked value configured in the range A1:B10 to 'checked'.
const range = SpreadsheetApp.getActive().getRange('A1:B10');
range.check();

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

clear()

इससे कॉन्टेंट और फ़ॉर्मैट की रेंज मिट जाती है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('A1:D10');
range.clear();

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

clear(options)

इससे कॉन्टेंट, फ़ॉर्मैट, डेटा की पुष्टि करने के नियम, और/या टिप्पणियों की रेंज मिट जाती है. ऐसा, दिए गए बेहतर विकल्पों के हिसाब से होता है. डिफ़ॉल्ट रूप से, सारा डेटा मिटा दिया जाता है.

// The code below clears range C2:G7 in the active sheet, but preserves the
// format, data validation rules, and comments.
SpreadsheetApp.getActiveSheet().getRange(2, 3, 6, 5).clear({
  contentsOnly: true
});

पैरामीटर

नामटाइपब्यौरा
optionsObjectयह एक JavaScript ऑब्जेक्ट है. इसमें नीचे दिए गए बेहतर पैरामीटर शामिल होते हैं.

उन्नत पैरामीटर

नामटाइपब्यौरा
commentsOnlyBooleanसिर्फ़ टिप्पणियां मिटानी हैं या नहीं.
contentsOnlyBooleanसिर्फ़ कॉन्टेंट मिटाना है या नहीं.
formatOnlyBooleanसिर्फ़ फ़ॉर्मैट मिटाना है या नहीं. ध्यान दें कि फ़ॉर्मैट मिटाने पर, डेटा की पुष्टि करने के नियम भी मिट जाते हैं.
validationsOnlyBooleanडेटा की पुष्टि करने के नियमों को ही मिटाना है या नहीं.
skipFilteredRowsBooleanफ़िल्टर की गई लाइनों को मिटाने से बचना है या नहीं.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

clearContent()

इस फ़ंक्शन की मदद से, रेंज में मौजूद कॉन्टेंट को मिटाया जा सकता है. हालांकि, फ़ॉर्मैटिंग में कोई बदलाव नहीं होता.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('A1:D10');
range.clearContent();

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

clearDataValidations()

इस फ़ंक्शन का इस्तेमाल करके, रेंज के लिए डेटा की पुष्टि करने के नियमों को हटाया जा सकता है.

// Clear the data validation rules for cells A1:B5.
const range = SpreadsheetApp.getActive().getRange('A1:B5');
range.clearDataValidations();

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

clearFormat()

इससे इस रेंज के लिए फ़ॉर्मैटिंग हट जाती है.

इससे रेंज में मौजूद सेल या सेल के टेक्स्ट का फ़ॉर्मैट हट जाता है. हालांकि, इससे संख्या के फ़ॉर्मैटिंग के नियम रीसेट नहीं होते.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('A1:D10');
range.clearFormat();

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

clearNote()

यह फ़ंक्शन, दी गई सेल या सेल में मौजूद नोट को मिटाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('A1:D10');
range.clearNote();

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

collapseGroups()

यह फ़ंक्शन, रेंज में पूरी तरह से शामिल सभी ग्रुप को छोटा करता है. अगर कोई भी ग्रुप पूरी तरह से रेंज में नहीं है, तो रेंज में आंशिक रूप से मौजूद सबसे बड़े ग्रुप को छोटा कर दिया जाता है.

const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
const range = sheet.getActiveRange();

// All row and column groups within the range are collapsed.
range.collapseGroups();

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

copyFormatToRange(gridId, column, columnEnd, row, rowEnd)

रेंज की फ़ॉर्मैटिंग को दी गई जगह पर कॉपी करता है. अगर डेस्टिनेशन, सोर्स रेंज से बड़ा या छोटा है, तो सोर्स को उसके हिसाब से दोहराया या छोटा किया जाता है. ध्यान दें कि इस तरीके से सिर्फ़ फ़ॉर्मैटिंग कॉपी होती है.

gridId पैरामीटर के बारे में ज़्यादा जानकारी के लिए, getGridId() देखें.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const source = ss.getSheets()[0];

const range = source.getRange('B2:D4');

// This copies the formatting in B2:D4 in the source sheet to
// D4:F6 in the sheet with gridId 1555299895. Note that you can get the gridId
// of a sheet by calling sheet.getSheetId() or range.getGridId().
range.copyFormatToRange(1555299895, 4, 6, 4, 6);

पैरामीटर

नामटाइपब्यौरा
gridIdIntegerस्प्रेडशीट में मौजूद शीट का यूनीक आईडी. इससे कोई फ़र्क़ नहीं पड़ता कि शीट किस पोज़िशन पर है.
columnIntegerटारगेट रेंज का पहला कॉलम.
columnEndIntegerटारगेट रेंज का आखिरी कॉलम.
rowIntegerटारगेट रेंज की शुरुआती लाइन.
rowEndIntegerटारगेट रेंज की आखिरी लाइन.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

इन्हें भी देखें


copyFormatToRange(sheet, column, columnEnd, row, rowEnd)

रेंज की फ़ॉर्मैटिंग को दी गई जगह पर कॉपी करता है. अगर डेस्टिनेशन, सोर्स रेंज से बड़ा या छोटा है, तो सोर्स को उसके हिसाब से दोहराया या छोटा किया जाता है. ध्यान दें कि इस तरीके से सिर्फ़ फ़ॉर्मैटिंग कॉपी होती है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const source = ss.getSheets()[0];
const destination = ss.getSheets()[1];

const range = source.getRange('B2:D4');

// This copies the formatting in B2:D4 in the source sheet to
// D4:F6 in the second sheet
range.copyFormatToRange(destination, 4, 6, 4, 6);

पैरामीटर

नामटाइपब्यौरा
sheetSheetटारगेट शीट.
columnIntegerटारगेट रेंज का पहला कॉलम.
columnEndIntegerटारगेट रेंज का आखिरी कॉलम.
rowIntegerटारगेट रेंज की शुरुआती लाइन.
rowEndIntegerटारगेट रेंज की आखिरी लाइन.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

copyTo(destination)

यह फ़ंक्शन, सेल की किसी रेंज से डेटा को सेल की दूसरी रेंज में कॉपी करता है. वैल्यू और फ़ॉर्मैट, दोनों कॉपी किए जाते हैं.

// The code below copies the first 5 columns over to the 6th column.
const sheet = SpreadsheetApp.getActiveSheet();
const rangeToCopy = sheet.getRange(1, 1, sheet.getMaxRows(), 5);
rangeToCopy.copyTo(sheet.getRange(1, 6));

पैरामीटर

नामटाइपब्यौरा
destinationRangeकॉपी करने के लिए डेस्टिनेशन रेंज; सिर्फ़ सबसे ऊपर बाईं ओर के सेल की पोज़िशन काम की होती है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

copyTo(destination, copyPasteType, transposed)

यह फ़ंक्शन, सेल की किसी रेंज से डेटा को सेल की दूसरी रेंज में कॉपी करता है.

// The code below copies only the values of the first 5 columns over to the 6th
// column.
const sheet = SpreadsheetApp.getActiveSheet();
sheet.getRange('A:E').copyTo(
    sheet.getRange('F1'),
    SpreadsheetApp.CopyPasteType.PASTE_VALUES,
    false,
);

पैरामीटर

नामटाइपब्यौरा
destinationRangeकॉपी करने के लिए डेस्टिनेशन रेंज; सिर्फ़ सबसे ऊपर बाईं ओर के सेल की पोज़िशन काम की होती है.
copyPasteTypeCopyPasteTypeयह एक ऐसा टाइप है जो यह तय करता है कि रेंज का कॉन्टेंट, डेस्टिनेशन में कैसे चिपकाया जाएगा.
transposedBooleanचुनें कि रेंज को ट्रांसपोज़ किए गए ओरिएंटेशन में चिपकाया जाना चाहिए या नहीं.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

copyTo(destination, options)

यह फ़ंक्शन, सेल की किसी रेंज से डेटा को सेल की दूसरी रेंज में कॉपी करता है. डिफ़ॉल्ट रूप से, वैल्यू और फ़ॉर्मैटिंग, दोनों कॉपी की जाती हैं. हालांकि, अडवांस आर्ग्युमेंट का इस्तेमाल करके इसे बदला जा सकता है.

// The code below copies only the values of the first 5 columns over to the 6th
// column.
const sheet = SpreadsheetApp.getActiveSheet();
sheet.getRange('A:E').copyTo(sheet.getRange('F1'), {contentsOnly: true});

पैरामीटर

नामटाइपब्यौरा
destinationRangeकॉपी करने के लिए डेस्टिनेशन रेंज; सिर्फ़ सबसे ऊपर बाईं ओर के सेल की पोज़िशन काम की होती है.
optionsObjectयह एक JavaScript ऑब्जेक्ट है. इसमें नीचे दिए गए बेहतर पैरामीटर शामिल होते हैं.

उन्नत पैरामीटर

नामटाइपब्यौरा
formatOnlyBooleanइससे पता चलता है कि सिर्फ़ फ़ॉर्मैट कॉपी करना है
contentsOnlyBooleanइससे पता चलता है कि सिर्फ़ कॉन्टेंट को कॉपी किया जाना चाहिए

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

copyValuesToRange(gridId, column, columnEnd, row, rowEnd)

रेंज के कॉन्टेंट को दी गई जगह पर कॉपी करता है. अगर डेस्टिनेशन, सोर्स रेंज से बड़ा या छोटा है, तो सोर्स को उसके हिसाब से दोहराया या छोटा किया जाता है.

gridId पैरामीटर के बारे में ज़्यादा जानकारी के लिए, getGridId() देखें.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const source = ss.getSheets()[0];

const range = source.getRange('B2:D4');

// This copies the data in B2:D4 in the source sheet to
// D4:F6 in the sheet with gridId 0
range.copyValuesToRange(0, 4, 6, 4, 6);

पैरामीटर

नामटाइपब्यौरा
gridIdIntegerस्प्रेडशीट में मौजूद शीट का यूनीक आईडी. इससे कोई फ़र्क़ नहीं पड़ता कि शीट किस पोज़िशन पर है.
columnIntegerटारगेट रेंज का पहला कॉलम.
columnEndIntegerटारगेट रेंज का आखिरी कॉलम.
rowIntegerटारगेट रेंज की शुरुआती लाइन.
rowEndIntegerटारगेट रेंज की आखिरी लाइन.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

इन्हें भी देखें


copyValuesToRange(sheet, column, columnEnd, row, rowEnd)

रेंज के कॉन्टेंट को दी गई जगह पर कॉपी करता है. अगर डेस्टिनेशन, सोर्स रेंज से बड़ा या छोटा है, तो सोर्स को उसके हिसाब से दोहराया या छोटा किया जाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const source = ss.getSheets()[0];
const destination = ss.getSheets()[1];

const range = source.getRange('B2:D4');

// This copies the data in B2:D4 in the source sheet to
// D4:F6 in the second sheet
range.copyValuesToRange(destination, 4, 6, 4, 6);

पैरामीटर

नामटाइपब्यौरा
sheetSheetटारगेट शीट.
columnIntegerटारगेट रेंज का पहला कॉलम.
columnEndIntegerटारगेट रेंज का आखिरी कॉलम.
rowIntegerटारगेट रेंज की शुरुआती लाइन.
rowEndIntegerटारगेट रेंज की आखिरी लाइन.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

createDataSourcePivotTable(dataSource)

यह फ़ंक्शन, डेटा सोर्स से एक खाली डेटा सोर्स पिवट टेबल बनाता है. यह टेबल, इस रेंज की पहली सेल में ऐंकर की जाती है.

इस उदाहरण में, नई डेटा सोर्स पिवट टेबल बनाने और उसे कॉन्फ़िगर करने का तरीका दिखाया गया है.

const spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
const anchorCell = spreadsheet.getSheets()[0].getRange('A1');
const dataSource = spreadsheet.getDataSources()[0];

const pivotTable = anchorCell.createDataSourcePivotTable(dataSource);
pivotTable.addRowGroup('dataColumnA');
pivotTable.addColumnGroup('dataColumnB');
pivotTable.addPivotValue(
    'dataColumnC',
    SpreadsheetApp.PivotTableSummarizeFunction.SUM,
);
pivotTable.addFilter(
    'dataColumnA',
    SpreadsheetApp.newFilterCriteria().whenTextStartsWith('A').build(),
);

पैरामीटर

नामटाइपब्यौरा
dataSourceDataSourceवह डेटा सोर्स जिससे पिवट टेबल बनानी है.

वापसी का टिकट

DataSourcePivotTable — यह नई बनाई गई डेटा सोर्स पिवट टेबल है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

createDataSourceTable(dataSource)

यह फ़ंक्शन, डेटा सोर्स से एक खाली डेटा सोर्स टेबल बनाता है. यह टेबल, इस रेंज के पहले सेल पर ऐंकर की जाती है.

इस उदाहरण में, नई डेटा सोर्स टेबल बनाने और उसे कॉन्फ़िगर करने का तरीका दिखाया गया है.

const spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
const anchorCell = spreadsheet.getSheets()[0].getRange('A1');
const dataSource = spreadsheet.getDataSources()[0];

const dataSourceTable =
    anchorCell.createDataSourceTable(dataSource)
        .addColumns('dataColumnA', 'dataColumnB', 'dataColumnC')
        .addSortSpec('dataColumnA', true)    // ascending=true
        .addSortSpec('dataColumnB', false);  // ascending=false

पैरामीटर

नामटाइपब्यौरा
dataSourceDataSourceवह डेटा सोर्स जिससे पिवट टेबल बनानी है.

वापसी का टिकट

DataSourceTable — यह नई बनाई गई डेटा सोर्स टेबल है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

createDeveloperMetadataFinder()

यह फ़ंक्शन, इस रेंज के दायरे में डेवलपर मेटाडेटा ढूंढने के लिए DeveloperMetadataFinderApi दिखाता है. मेटाडेटा को रेंज के दायरे में सिर्फ़ तब माना जाता है, जब वह पूरी तरह से उस रेंज में शामिल हो. उदाहरण के लिए, ‘3:3’ लाइन से जुड़ा मेटाडेटा, ‘A1:D5’ रेंज के स्कोप में नहीं है. हालांकि, यह ‘1:5’ रेंज के स्कोप में है.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets the range A1:C6.
const range = sheet.getRange('A1:C6');

// Creates a developer metadata finder to search for metadata in the scope of
// this range.
const developerMetaDataFinder = range.createDeveloperMetadataFinder();

// Logs information about the developer metadata finder to the console.
const developerMetaData = developerMetaDataFinder.find()[0];
console.log(developerMetaData.getKey());
console.log(developerMetaData.getValue());
console.log(developerMetaData.getVisibility().toString());

वापसी का टिकट

DeveloperMetadataFinder — डेवलपर मेटाडेटा ढूंढने वाला टूल, जो इस रेंज के दायरे में मेटाडेटा खोजता है.


createFilter()

यह फ़ंक्शन, फ़िल्टर बनाता है और उसे शीट पर मौजूद तय की गई रेंज पर लागू करता है. किसी शीट पर एक से ज़्यादा फ़िल्टर नहीं बनाए जा सकते. फ़िल्टर बनाने के बाद, उसे ऐक्सेस करने और उसमें बदलाव करने के लिए, getFilter() या Sheet.getFilter() का इस्तेमाल करें.

const ss = SpreadsheetApp.getActiveSheet();
const range = ss.getRange('A1:C20');

// Creates a new filter and applies it to the range A1:C20 on the active sheet.
function createFilter() {
  range.createFilter();
}
// Gets the filter and applies criteria that only shows cells that aren't empty.
function getFilterAddCriteria() {
  const filter = range.getFilter();
  const criteria =
      SpreadsheetApp.newFilterCriteria().whenCellNotEmpty().build();
  filter.setColumnFilterCriteria(2, criteria);
}
इस तरीके का इस्तेमाल करके, Grid शीट के लिए फ़िल्टर बनाएं. यह शीट का डिफ़ॉल्ट टाइप होता है. ग्रिड शीट ऐसी शीट होती हैं जो किसी डेटाबेस से कनेक्ट नहीं होती हैं. अन्य तरह के फ़िल्टर बनाने के लिए, यहां दिया गया लेख पढ़ें:

वापसी का टिकट

Filter — नया फ़िल्टर.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

createPivotTable(sourceData)

इस फ़ंक्शन की मदद से, तय की गई रेंज की पहली सेल में ऐंकर की गई sourceData से एक खाली पिवट टेबल बनाई जाती है.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets cell A1 as a range in order to place the pivot table.
const range = sheet.getRange('A1');

// Gets the range of the source data for the pivot table.
const dataRange = sheet.getRange('E12:G20');

// Creates an empty pivot table from the specified source data.
const pivotTable = range.createPivotTable(dataRange);

// Logs the values from the pivot table's source data to the console.
console.log(pivotTable.getSourceDataRange().getValues());

पैरामीटर

नामटाइपब्यौरा
sourceDataRangeवह डेटा जिससे पिवट टेबल बनानी है.

वापसी का टिकट

PivotTable — नया बनाया गया PivotTable.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

createTextFinder(findText)

यह फ़ंक्शन, रेंज के लिए टेक्स्ट फ़ाइंडर बनाता है. इसकी मदद से, इस रेंज में टेक्स्ट ढूंढा और बदला जा सकता है.

const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
const range = sheet.getActiveRange();

// Creates  a text finder for the range.
const textFinder = range.createTextFinder('dog');

// Returns the first occurrence of 'dog'.
const firstOccurrence = textFinder.findNext();

// Replaces the last found occurrence of 'dog' with 'cat' and returns the number
// of occurrences replaced.
const numOccurrencesReplaced = textFinder.replaceWith('cat');

पैरामीटर

नामटाइपब्यौरा
findTextStringवह टेक्स्ट जिसे खोजना है.

वापसी का टिकट

TextFinder — रेंज के लिए TextFinder


deleteCells(shiftDimension)

यह सेल की इस रेंज को मिटाता है. शीट में मौजूद डेटा को, मिटाई गई रेंज की ओर ले जाया जाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('A1:D10');
range.deleteCells(SpreadsheetApp.Dimension.COLUMNS);

पैरामीटर

नामटाइपब्यौरा
shiftDimensionDimensionवह डाइमेंशन जिसके हिसाब से मौजूदा डेटा को शिफ़्ट करना है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

expandGroups()

यह फ़ंक्शन, उन छोटे किए गए ग्रुप को बड़ा करता है जिनकी रेंज या कंट्रोल टॉगल, इस रेंज से इंटरसेक्ट करता है. कंट्रोल टॉगल की जगह, वह इंडेक्स होती है जिस पर कंट्रोल टॉगल दिखता है. यह ग्रुप से ठीक पहले या बाद में दिखता है. यह सेटिंग पर निर्भर करता है. अगर एक ही जगह पर एक से ज़्यादा ग्रुप हैं, तो सबसे छोटे ग्रुप को बड़ा किया जाता है.

const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
const range = sheet.getActiveRange();

// All row and column groups within the range are expanded.
range.expandGroups();

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getA1Notation()

यह फ़ंक्शन, A1 नोटेशन में रेंज की स्ट्रिंग के बारे में जानकारी देता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange(1, 1, 2, 5);

// Logs "A1:E2"
Logger.log(range.getA1Notation());

वापसी का टिकट

String — A1 नोटेशन में रेंज की जानकारी देने वाली स्ट्रिंग.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getBackground()

यह फ़ंक्शन, रेंज में सबसे ऊपर मौजूद बाएं सेल के बैकग्राउंड का रंग दिखाता है. उदाहरण के लिए, '#ffffff'.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B5');
Logger.log(cell.getBackground());

वापसी का टिकट

String — बैकग्राउंड का कलर कोड.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getBackgroundObject()

यह फ़ंक्शन, रेंज में सबसे ऊपर मौजूद बाएं सेल के बैकग्राउंड का रंग दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B5');
Logger.log(cell.getBackgroundObject().asRgbColor().asHexString());

वापसी का टिकट

Color — रेंज में सबसे ऊपर मौजूद बाईं ओर की सेल के बैकग्राउंड का रंग.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getBackgroundObjects()

यह फ़ंक्शन, रेंज में मौजूद सेल के बैकग्राउंड के रंग दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('B5:C6');
const bgColors = range.getBackgroundObjects();
for (const i in bgColors) {
  for (const j in bgColors[i]) {
    Logger.log(bgColors[i][j].asRgbColor().asHexString());
  }
}

वापसी का टिकट

Color[][] — बैकग्राउंड के रंगों का दो डाइमेंशन वाला ऐरे.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getBackgrounds()

यह फ़ंक्शन, रेंज में मौजूद सेल के बैकग्राउंड के रंग दिखाता है. उदाहरण के लिए, '#ffffff'.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('B5:C6');
const bgColors = range.getBackgrounds();
for (const i in bgColors) {
  for (const j in bgColors[i]) {
    Logger.log(bgColors[i][j]);
  }
}

वापसी का टिकट

String[][] — यह बैकग्राउंड के रंग के कोड का दो डाइमेंशन वाला ऐरे होता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getBandings()

इस फ़ंक्शन से, इस रेंज में मौजूद किसी भी सेल पर लागू की गई सभी बैंडिंग मिलती हैं.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Sets a range.
const range = sheet.getRange('A1:K50');

// Gets the banding info for the range.
const bandings = range.getBandings();

// Logs the second row color for each banding to the console.
for (const banding of bandings) {
  console.log(banding.getSecondRowColor());
}

वापसी का टिकट

Banding[] — इस रेंज की किसी भी सेल पर लागू की गई सभी बैंडिंग.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getCell(row, column)

यह फ़ंक्शन, किसी रेंज में मौजूद सेल की जानकारी देता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('B2:D4');

// The row and column here are relative to the range
// getCell(1,1) in this code returns the cell at B2
const cell = range.getCell(1, 1);
Logger.log(cell.getValue());

पैरामीटर

नामटाइपब्यौरा
rowIntegerयह रेंज के हिसाब से सेल की लाइन होती है.
columnIntegerयह रेंज के हिसाब से सेल का कॉलम होता है.

वापसी का टिकट

Range — यह एक ऐसी रेंज होती है जिसमें दिए गए निर्देशांकों पर मौजूद एक सेल शामिल होती है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getColumn()

यह फ़ंक्शन, इस रेंज के लिए शुरुआती कॉलम की पोज़िशन दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('B2:D4');
// Logs "2.0"
Logger.log(range.getColumn());

वापसी का टिकट

Integer — स्प्रेडशीट में रेंज के शुरुआती कॉलम की पोज़िशन.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getDataRegion()

यह फ़ंक्शन, रेंज की एक कॉपी दिखाता है. इस कॉपी में, रेंज को चारों दिशाओं Direction में बढ़ाया जाता है, ताकि डेटा वाले सभी आस-पास के सेल शामिल किए जा सकें. अगर रेंज के चारों ओर खाली सेल हैं और उनमें डायगोनल के साथ मौजूद सेल शामिल नहीं हैं, तो रेंज ही दिखाई जाती है. यह एडिटर में रेंज चुनने और Ctrl+A टाइप करने जैसा है.

// Assume the active spreadsheet is blank.
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
sheet.getRange('C2').setValue(100);
sheet.getRange('B3').setValue(100);
sheet.getRange('D3').setValue(100);
sheet.getRange('C4').setValue(100);
// Logs "B2:D4"
Logger.log(sheet.getRange('C3').getDataRegion().getA1Notation());

वापसी का टिकट

Range — यह रेंज का डेटा क्षेत्र या पूरी स्प्रेडशीट के लिए रेंज होती है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getDataRegion(dimension)

अगर तय किया गया डाइमेंशन Dimension.ROWS है, तो यह फ़ंक्शन, Direction.UP और Direction.DOWN के तौर पर बड़ा किए गए रेंज की कॉपी दिखाता है. अगर डाइमेंशन Dimension.COLUMNS है, तो यह फ़ंक्शन, Direction.NEXT और Direction.PREVIOUS के तौर पर बड़ा किए गए रेंज की कॉपी दिखाता है. रेंज को बड़ा करने की सुविधा, टेबल की तरह व्यवस्थित की गई रेंज के बगल में मौजूद डेटा का पता लगाने पर काम करती है. बढ़ाई गई रेंज में, तय किए गए डाइमेंशन के हिसाब से, डेटा वाली सभी आस-पास की सेल शामिल होती हैं. इसमें टेबल की सीमाएं भी शामिल होती हैं. अगर बताई गई डाइमेंशन के हिसाब से ओरिजनल रेंज के चारों ओर खाली सेल हैं, तो रेंज को ही दिखाया जाता है. यह तरीका, एडिटर में कॉलम के लिए Ctrl+Space या लाइनों के लिए Shift+Space टाइप करके रेंज चुनने जैसा ही है.

// Assume the active spreadsheet is blank.
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
sheet.getRange('C2').setValue(100);
sheet.getRange('B3').setValue(100);
sheet.getRange('D3').setValue(100);
sheet.getRange('C4').setValue(100);
// Logs "C2:C4"
Logger.log(
    sheet.getRange('C3')
        .getDataRegion(SpreadsheetApp.Dimension.ROWS)
        .getA1Notation(),
);
// Logs "B3:D3"
Logger.log(
    sheet.getRange('C3')
        .getDataRegion(SpreadsheetApp.Dimension.COLUMNS)
        .getA1Notation(),
);

पैरामीटर

नामटाइपब्यौरा
dimensionDimensionवह डाइमेंशन जिसके हिसाब से रेंज को बड़ा करना है.

वापसी का टिकट

Range — यह रेंज का डेटा क्षेत्र या ऐसी रेंज होती है जिसमें ओरिजनल रेंज के हर कॉलम या हर लाइन को शामिल किया जाता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getDataSourceFormula()

यह फ़ंक्शन, रेंज में मौजूद पहली सेल के लिए DataSourceFormula वैल्यू दिखाता है. अगर सेल में डेटा सोर्स का फ़ॉर्मूला नहीं है, तो यह null वैल्यू दिखाता है.

// Opens the spreadsheet file by its ID. If you created your script from a
// Google Sheets file, use SpreadsheetApp.getActiveSpreadsheet().
// TODO(developer): Replace the ID with your own.
const ss = SpreadsheetApp.openById('abc123456');

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets the range A1 on Sheet1.
const range = sheet.getRange('A1');

// Gets the data source formula from cell A1.
const dataSourceFormula = range.getDataSourceFormula();

// Gets the formula.
const formula = dataSourceFormula.getFormula();

// Logs the formula.
console.log(formula);

वापसी का टिकट

DataSourceFormula — सेल के लिए DataSourceFormula.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getDataSourceFormulas()

यह फ़ंक्शन, रेंज में मौजूद सेल के लिए DataSourceFormula दिखाता है.

// Opens the spreadsheet file by its ID. If you created your script from a
// Google Sheets file, use SpreadsheetApp.getActiveSpreadsheet().
// TODO(developer): Replace the ID with your own.
const ss = SpreadsheetApp.openById('abc123456');

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets the range A1:B5 on Sheet1.
const range = sheet.getRange('A1:B5');

// Gets an array of the data source formulas in the range A1:B5.
const dataSourceFormulas = range.getDataSourceFormulas();

// Logs the first formula in the array.
console.log(dataSourceFormulas[0].getFormula());

वापसी का टिकट

DataSourceFormula[]DataSourceFormula की एक कैटगरी.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getDataSourcePivotTables()

इस फ़ंक्शन से, रेंज में मौजूद सभी डेटा सोर्स पिवट टेबल मिलती हैं.

// Opens the spreadsheet file by its ID. If you created your script from a
// Google Sheets file, use SpreadsheetApp.getActiveSpreadsheet().
// TODO(developer): Replace the ID with your own.
const ss = SpreadsheetApp.openById('abc123456');

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets the range A1:G50 on Sheet1.
const range = sheet.getRange('A1:G50');

// Gets an array of the data source pivot tables in the range A1:G50.
const dataSourcePivotTables = range.getDataSourcePivotTables();

// Logs the last time that the first pivot table in the array was refreshed.
console.log(dataSourcePivotTables[0].getStatus().getLastRefreshedTime());

वापसी का टिकट

DataSourcePivotTable[] — डेटा सोर्स की पिवट टेबल की सूची.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getDataSourceTables()

इस फ़ंक्शन से, रेंज के साथ इंटरसेक्ट करने वाली सभी डेटा सोर्स टेबल मिलती हैं.

// Opens the spreadsheet file by its ID. If you created your script from a
// Google Sheets file, use SpreadsheetApp.getActiveSpreadsheet().
// TODO(developer): Replace the ID with your own.
const ss = SpreadsheetApp.openById('abc123456');

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets the range A1:G50 on Sheet1.
const range = sheet.getRange('A1:G50');

// Gets the first data source table in the range A1:G50.
const dataSourceTable = range.getDataSourceTables()[0];

// Logs the time of the last completed data execution on the data source table.
console.log(dataSourceTable.getStatus().getLastExecutionTime());

वापसी का टिकट

DataSourceTable[] — डेटा सोर्स टेबल की सूची.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getDataSourceUrl()

यह फ़ंक्शन, इस रेंज में मौजूद डेटा के लिए यूआरएल दिखाता है. इसका इस्तेमाल चार्ट और क्वेरी बनाने के लिए किया जा सकता है.

Code.gs

function doGet() {
  const ss = SpreadsheetApp.openById(
      '1khO6hBWTNNyvyyxvob7aoZTI9ZvlqqASNeq0e29Tw2c',
  );
  const sheet = ss.getSheetByName('ContinentData');
  const range = sheet.getRange('A1:B8');

  const template = HtmlService.createTemplateFromFile('piechart');
  template.dataSourceUrl = range.getDataSourceUrl();
  return template.evaluate();
}

piechart.html

<!DOCTYPE html>
<html>
  <head>
    <!--Load the AJAX API-->
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
      // Load the Visualization API and the corechart package.
      google.charts.load('current', {'packages': ['corechart']});

      // Set a callback to run when the Google Visualization API is loaded.
      google.charts.setOnLoadCallback(queryData);

      function queryData() {
        var query = new google.visualization.Query('<?= dataSourceUrl ?>');
        query.send(drawChart);
      }

      // Callback that creates and populates a data table,
      // instantiates the pie chart, passes in the data and
      // draws it.
      function drawChart(response) {
        if (response.isError()) {
          alert('Error: ' + response.getMessage() + ' ' + response.getDetailedMessage());
          return;
        }
        var data = response.getDataTable();

        // Set chart options.
        var options = {
          title: 'Population by Continent',
          width: 400,
          height: 300
        };

        // Instantiate and draw the chart, passing in some options.
        var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <!-- Div that holds the pie chart. -->
    <div id="chart_div"></div>
  </body>
</html>

वापसी का टिकट

String — इस रेंज के लिए डेटा सोर्स के तौर पर एक यूआरएल. इसे चार्ट जैसे अन्य एपीआई को पास किया जा सकता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getDataTable()

इस ऑब्जेक्ट में मौजूद डेटा को DataTable के तौर पर दिखाएं.

// Opens the spreadsheet file by its ID. If you created your script from a
// Google Sheets file, use SpreadsheetApp.getActiveSpreadsheet().
// TODO(developer): Replace the ID with your own.
const ss = SpreadsheetApp.openById('abc123456');

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets the range A1:B7 on Sheet1.
const range = sheet.getRange('A1:B7');

// Gets the range A1:B7 as a data table. The values in each column must be of
// the same type.
const datatable = range.getDataTable();

// Uses the Charts service to build a bar chart from the data table.
// This doesn't build an embedded chart. To do that, use
// sheet.newChart().addRange() instead.
const chart = Charts.newBarChart()
                  .setDataTable(datatable)
                  .setOption('title', 'Your Chart Title Here')
                  .build();

वापसी का टिकट

DataTable — डेटा को डेटाटेबल के तौर पर दिखाता है.


getDataTable(firstRowIsHeader)

इस रेंज में मौजूद डेटा को DataTable के तौर पर दिखाओ.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('A1:B7');

// Calling this method with "true" sets the first line to be the title of the
// axes
const datatable = range.getDataTable(true);

// Note that this doesn't build an EmbeddedChart, so you can't just use
// Sheet#insertChart(). To do that, use sheet.newChart().addRange() instead.
const chart = Charts.newBarChart()
                  .setDataTable(datatable)
                  .setOption('title', 'Your Title Here')
                  .build();

पैरामीटर

नामटाइपब्यौरा
firstRowIsHeaderBooleanपहली लाइन को हेडर के तौर पर इस्तेमाल करना है या नहीं.

वापसी का टिकट

DataTable — डेटा को डेटाटेबल के तौर पर दिखाया जाता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getDataValidation()

यह फ़ंक्शन, रेंज में सबसे ऊपर मौजूद बाएं सेल के लिए, डेटा की पुष्टि करने का नियम दिखाता है. अगर सेल में डेटा की पुष्टि करने की सुविधा सेट नहीं की गई है, तो यह तरीका null दिखाता है.

// Log information about the data validation rule for cell A1.
const cell = SpreadsheetApp.getActive().getRange('A1');
const rule = cell.getDataValidation();
if (rule != null) {
  const criteria = rule.getCriteriaType();
  const args = rule.getCriteriaValues();
  Logger.log('The data validation rule is %s %s', criteria, args);
} else {
  Logger.log('The cell does not have a data validation rule.');
}

वापसी का टिकट

DataValidation — यह रेंज में सबसे ऊपर मौजूद बाएं सेल के लिए, डेटा की पुष्टि करने का नियम है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getDataValidations()

यह फ़ंक्शन, रेंज में मौजूद सभी सेल के लिए डेटा की पुष्टि करने के नियम दिखाता है. अगर किसी सेल पर डेटा की पुष्टि करने की सुविधा सेट नहीं की गई है, तो यह तरीका उस सेल की पोज़िशन के लिए null दिखाता है.

// Change existing data validation rules that require a date in 2013 to require
// a date in 2014.
const oldDates = [new Date('1/1/2013'), new Date('12/31/2013')];
const newDates = [new Date('1/1/2014'), new Date('12/31/2014')];
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange(1, 1, sheet.getMaxRows(), sheet.getMaxColumns());
const rules = range.getDataValidations();

for (let i = 0; i < rules.length; i++) {
  for (let j = 0; j < rules[i].length; j++) {
    const rule = rules[i][j];

    if (rule != null) {
      const criteria = rule.getCriteriaType();
      const args = rule.getCriteriaValues();

      if (criteria === SpreadsheetApp.DataValidationCriteria.DATE_BETWEEN &&
          args[0].getTime() === oldDates[0].getTime() &&
          args[1].getTime() === oldDates[1].getTime()) {
        // Create a builder from the existing rule, then change the dates.
        rules[i][j] = rule.copy().withCriteria(criteria, newDates).build();
      }
    }
  }
}
range.setDataValidations(rules);

वापसी का टिकट

DataValidation[][] — यह डेटा की पुष्टि करने से जुड़े नियमों की दो डाइमेंशन वाली एक ऐसी सरणी होती है जो रेंज में मौजूद सेल से जुड़ी होती है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getDeveloperMetadata()

इस रेंज से जुड़ा डेवलपर मेटाडेटा मिलता है.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets row 2 on Sheet1.
const range = sheet.getRange('2:2');

// Adds metadata to row 2.
range.addDeveloperMetadata('NAME', 'GOOGLE');

// Logs the metadata to console.
for (const metadata of range.getDeveloperMetadata()) {
  console.log(`${metadata.getKey()}: ${metadata.getValue()}`);
}

वापसी का टिकट

DeveloperMetadata[] — इस रेंज से जुड़ा डेवलपर मेटाडेटा.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getDisplayValue()

इस फ़ंक्शन से, रेंज में सबसे ऊपर मौजूद बाएं सेल की दिखाई गई वैल्यू मिलती है. वैल्यू String है. दिखाई गई वैल्यू में तारीख, समय, और मुद्रा के फ़ॉर्मैटिंग फ़ॉर्मैटिंग को ध्यान में रखा जाता है. इसमें स्प्रेडशीट की स्थान-भाषा की सेटिंग के हिसाब से अपने-आप लागू होने वाले फ़ॉर्मैट भी शामिल हैं. खाली सेल, खाली स्ट्रिंग दिखाता है.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets cell A30 and sets its value to 'Test code.'
const cell = sheet.getRange('A30');
cell.setValue('Test code');

// Gets the value and logs it to the console.
console.log(cell.getDisplayValue());

वापसी का टिकट

String — इस सेल में दिखाई गई वैल्यू.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getDisplayValues()

यह फ़ंक्शन, इस रेंज के लिए वैल्यू का आयताकार ग्रिड दिखाता है.

यह फ़ंक्शन, दिखाई गई वैल्यू का दो डाइमेंशन वाला ऐरे दिखाता है. इसे पहले पंक्ति और फिर कॉलम के हिसाब से इंडेक्स किया जाता है. ये वैल्यू, String ऑब्जेक्ट हैं. दिखाई गई वैल्यू में तारीख, समय, और मुद्रा के फ़ॉर्मैट को ध्यान में रखा जाता है. इसमें स्प्रेडशीट की स्थान-भाषा की सेटिंग के हिसाब से अपने-आप लागू होने वाले फ़ॉर्मैट भी शामिल हैं. खाली सेल को कैटगरी में, खाली स्ट्रिंग के तौर पर दिखाया जाता है. ध्यान दें कि रेंज इंडेक्स 1, 1 से शुरू होता है, जबकि JavaScript कलेक्शन को [0][0] से इंडेक्स किया जाता है.

// The code below gets the displayed values for the range C2:G8
// in the active spreadsheet.  Note that this is a JavaScript array.
const values =
    SpreadsheetApp.getActiveSheet().getRange(2, 3, 6, 4).getDisplayValues();
Logger.log(values[0][0]);

वापसी का टिकट

String[][] — वैल्यू की दो डाइमेंशन वाली सरणी.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFilter()

यह फ़ंक्शन, उस शीट पर मौजूद फ़िल्टर दिखाता है जिससे यह रेंज जुड़ी है. अगर शीट पर कोई फ़िल्टर नहीं है, तो यह null दिखाता है.

const ss = SpreadsheetApp.getActiveSheet();
const range = ss.getRange('A1:C20');
// Gets the existing filter on the sheet that the given range belongs to.
const filter = range.getFilter();

वापसी का टिकट

Filter — फ़िल्टर.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFontColorObject()

यह फ़ंक्शन, रेंज के सबसे ऊपर मौजूद बाएं कोने में मौजूद सेल के फ़ॉन्ट का रंग दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

Logger.log(range.getFontColorObject().asRgbColor().asHexString());

वापसी का टिकट

Color — रेंज में सबसे ऊपर मौजूद बाएं सेल के फ़ॉन्ट का रंग.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFontColorObjects()

इस फ़ंक्शन से, रेंज में मौजूद सेल के फ़ॉन्ट के रंग मिलते हैं.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

const results = range.getFontColorObjects();

for (const i in results) {
  for (const j in results[i]) {
    Logger.log(results[i][j].asRgbColor().asHexString());
  }
}

वापसी का टिकट

Color[][] — यह रेंज में मौजूद सेल से जुड़े फ़ॉन्ट के रंगों की दो डाइमेंशन वाली सरणी होती है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFontFamilies()

इस फ़ंक्शन से, रेंज में मौजूद सेल की फ़ॉन्ट फ़ैमिली मिलती हैं.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

const results = range.getFontFamilies();

for (const i in results) {
  for (const j in results[i]) {
    Logger.log(results[i][j]);
  }
}

वापसी का टिकट

String[][] — यह रेंज में मौजूद सेल से जुड़ी फ़ॉन्ट फ़ैमिली का दो डाइमेंशन वाला कलेक्शन होता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFontFamily()

यह विकल्प, रेंज के सबसे ऊपर मौजूद बाएं कोने में मौजूद सेल की फ़ॉन्ट फ़ैमिली दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

Logger.log(range.getFontFamily());

वापसी का टिकट

String — सेल की फ़ॉन्ट फ़ैमिली.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFontLine()

इस फ़ंक्शन से, रेंज के सबसे ऊपर बाएं कोने में मौजूद सेल ('underline', 'line-through' या 'none') की लाइन स्टाइल मिलती है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

Logger.log(range.getFontLine());

वापसी का टिकट

String — फ़ॉन्ट लाइन.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFontLines()

इस फ़ंक्शन से, रेंज में मौजूद सेल की लाइन स्टाइल ('underline', 'line-through' या 'none') मिलती है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

const results = range.getFontLines();

for (const i in results) {
  for (const j in results[i]) {
    Logger.log(results[i][j]);
  }
}

वापसी का टिकट

String[][] — यह रेंज में मौजूद सेल से जुड़ी फ़ॉन्ट लाइनों की दो डाइमेंशन वाली सरणी होती है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFontSize()

यह फ़ंक्शन, रेंज के सबसे ऊपर मौजूद बाएं कोने वाले सेल के फ़ॉन्ट का साइज़ पॉइंट में दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

Logger.log(range.getFontSize());

वापसी का टिकट

Integer — पॉइंट साइज़ में फ़ॉन्ट का साइज़.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFontSizes()

इस फ़ंक्शन से, रेंज में मौजूद सेल के फ़ॉन्ट साइज़ मिलते हैं.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

const results = range.getFontSizes();

for (const i in results) {
  for (const j in results[i]) {
    Logger.log(results[i][j]);
  }
}

वापसी का टिकट

Integer[][] — यह रेंज में मौजूद सेल से जुड़े टेक्स्ट के फ़ॉन्ट साइज़ का दो डाइमेंशन वाला कलेक्शन होता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFontStyle()

यह फ़ंक्शन, रेंज के सबसे ऊपर मौजूद बाएं कोने वाले सेल का फ़ॉन्ट स्टाइल ('italic' या 'normal') दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

Logger.log(range.getFontStyle());

वापसी का टिकट

String — सेल में मौजूद टेक्स्ट का फ़ॉन्ट स्टाइल.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFontStyles()

इस फ़ंक्शन की मदद से, रेंज में मौजूद सेल के फ़ॉन्ट स्टाइल की जानकारी मिलती है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

const results = range.getFontStyles();

for (const i in results) {
  for (const j in results[i]) {
    Logger.log(results[i][j]);
  }
}

वापसी का टिकट

String[][] — यह रेंज में मौजूद सेल से जुड़े टेक्स्ट की फ़ॉन्ट स्टाइल का दो डाइमेंशन वाला कलेक्शन होता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFontWeight()

यह फ़ंक्शन, रेंज के सबसे ऊपर मौजूद बाएं कोने वाले सेल के फ़ॉन्ट का वेट (सामान्य/बोल्ड) दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

Logger.log(range.getFontWeight());

वापसी का टिकट

String — सेल में मौजूद टेक्स्ट का फ़ॉन्ट वेट.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFontWeights()

यह फ़ंक्शन, रेंज में मौजूद सेल के फ़ॉन्ट वेट दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

const results = range.getFontWeights();

for (const i in results) {
  for (const j in results[i]) {
    Logger.log(results[i][j]);
  }
}

वापसी का टिकट

String[][] — यह रेंज में मौजूद सेल से जुड़े टेक्स्ट के फ़ॉन्ट वेट की दो डाइमेंशन वाली एक ऐरे होती है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFormula()

यह फ़ंक्शन, रेंज की सबसे ऊपर बाईं ओर मौजूद सेल के लिए फ़ॉर्मूला (A1 नोटेशन) दिखाता है. अगर सेल खाली है या उसमें कोई फ़ॉर्मूला नहीं है, तो यह फ़ंक्शन एक खाली स्ट्रिंग दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

// This assumes you have a function in B5 that sums up
// B2:B4
const range = sheet.getRange('B5');

// Logs the calculated value and the formula
Logger.log(
    'Calculated value: %s Formula: %s',
    range.getValue(),
    range.getFormula(),
);

वापसी का टिकट

String — सेल का फ़ॉर्मूला.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFormulaR1C1()

किसी सेल के लिए फ़ॉर्मूला (R1C1 नोटेशन) दिखाता है. अगर कोई फ़ॉर्मूला नहीं है, तो null दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('B5');
const formula = range.getFormulaR1C1();
Logger.log(formula);

वापसी का टिकट

String — R1C1 नोटेशन में फ़ॉर्मूला.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFormulas()

यह फ़ंक्शन, रेंज में मौजूद सेल के लिए फ़ॉर्मूले (A1 नोटेशन) दिखाता है. 2D अरे में मौजूद एंट्री, उन सेल के लिए खाली स्ट्रिंग होती हैं जिनमें कोई फ़ॉर्मूला नहीं होता.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('B5:C6');
const formulas = range.getFormulas();
for (const i in formulas) {
  for (const j in formulas[i]) {
    Logger.log(formulas[i][j]);
  }
}

वापसी का टिकट

String[][] — स्ट्रिंग फ़ॉर्मैट में फ़ॉर्मूलों की दो डाइमेंशन वाली कैटगरी.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFormulasR1C1()

यह फ़ंक्शन, रेंज में मौजूद सेल के लिए फ़ॉर्मूले (R1C1 नोटेशन) दिखाता है. 2D ऐरे में मौजूद एंट्री, फ़ॉर्मूला नहीं होने पर null होती हैं.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('B5:C6');
const formulas = range.getFormulasR1C1();
for (const i in formulas) {
  for (const j in formulas[i]) {
    Logger.log(formulas[i][j]);
  }
}

वापसी का टिकट

String[][] — R1C1 नोटेशन में फ़ॉर्मूलों का दो डाइमेंशन वाला ऐरे.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getGridId()

यह फ़ंक्शन, रेंज की पैरंट शीट का ग्रिड आईडी दिखाता है. आईडी, रैंडम धनात्मक पूर्णांक वैल्यू होते हैं.

// Log the grid ID of the first sheet (by tab position) in the spreadsheet.
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

Logger.log(range.getGridId());

वापसी का टिकट

Integer — पैरंट शीट का ग्रिड आईडी.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getHeight()

यह फ़ंक्शन, रेंज की ऊंचाई दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('B2:D4');
// logs 3.0
Logger.log(range.getHeight());

वापसी का टिकट

Integer — रेंज की ऊंचाई.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getHorizontalAlignment()

यह फ़ंक्शन, रेंज के सबसे ऊपर बाएं कोने में मौजूद सेल के टेक्स्ट का हॉरिज़ॉन्टल अलाइनमेंट (बाएं/बीच/दाएं) दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

Logger.log(range.getHorizontalAlignment());

वापसी का टिकट

String — सेल में मौजूद टेक्स्ट का हॉरिज़ॉन्टल अलाइनमेंट.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getHorizontalAlignments()

यह फ़ंक्शन, रेंज में मौजूद सेल के हॉरिज़ॉन्टल अलाइनमेंट दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

const results = range.getHorizontalAlignments();

for (const i in results) {
  for (const j in results[i]) {
    Logger.log(results[i][j]);
  }
}

वापसी का टिकट

String[][] — यह रेंज में मौजूद सेल से जुड़े टेक्स्ट के हॉरिज़ॉन्टल अलाइनमेंट की दो डाइमेंशन वाली ऐरे होती है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getLastColumn()

यह फ़ंक्शन, आखिरी कॉलम की पोज़िशन दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('B2:D4');
// Logs "4.0"
Logger.log(range.getLastColumn());

वापसी का टिकट

Integer — स्प्रेडशीट में, रेंज के आखिरी कॉलम की पोज़िशन.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getLastRow()

आखिरी लाइन की पोज़िशन दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('B2:D4');
// Logs "4.0"
Logger.log(range.getLastRow());

वापसी का टिकट

Integer — स्प्रेडशीट में रेंज की आखिरी पंक्ति की पोज़िशन.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getMergedRanges()

यह फ़ंक्शन, Range ऑब्जेक्ट की एक ऐसी कलेक्शन दिखाता है जिसमें मर्ज की गई सेल शामिल होती हैं. ये सेल या तो पूरी तरह से मौजूदा रेंज में होती हैं या इनमें से कम से कम एक सेल मौजूदा रेंज में होती है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('A1:B3');

const mergedRanges = range.getMergedRanges();
for (let i = 0; i < mergedRanges.length; i++) {
  Logger.log(mergedRanges[i].getA1Notation());
  Logger.log(mergedRanges[i].getDisplayValue());
}

वापसी का टिकट

Range[]Range ऑब्जेक्ट का एक कलेक्शन. इससे, रेंज में शामिल मर्ज किए गए सेल के बारे में पता चलता है.


getNextDataCell(direction)

यह फ़ंक्शन, रेंज के पहले कॉलम और पहली लाइन में मौजूद सेल से शुरू होकर, दी गई दिशा में मौजूद अगली सेल दिखाता है. यह सेल, डेटा वाली सेल की लगातार रेंज का किनारा होती है या उस दिशा में स्प्रेडशीट के किनारे पर मौजूद सेल होती है. यह एडिटर में Ctrl+[arrow key] टाइप करने के बराबर है.

// Assume the active spreadsheet is blank.
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('C3:E5');
// Logs "C1"
Logger.log(range.getNextDataCell(SpreadsheetApp.Direction.UP).getA1Notation());

पैरामीटर

नामटाइपब्यौरा
directionDirectionअगले डेटा क्षेत्र की आखिरी सेल को खोजने की दिशा.

वापसी का टिकट

Range — डेटा क्षेत्र की आखिरी सेल या स्प्रेडशीट की आखिरी सेल.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getNote()

यह फ़ंक्शन, दी गई रेंज से जुड़ा नोट दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

Logger.log(range.getNote());

वापसी का टिकट

String — दी गई सेल से जुड़ा नोट.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getNotes()

यह फ़ंक्शन, रेंज में मौजूद सेल से जुड़े नोट दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

const results = range.getNotes();

for (const i in results) {
  for (const j in results[i]) {
    Logger.log(results[i][j]);
  }
}

वापसी का टिकट

String[][] — यह रेंज में मौजूद सेल से जुड़े नोट की दो डाइमेंशन वाली एक सरणी होती है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getNumColumns()

यह फ़ंक्शन, इस रेंज में मौजूद कॉलम की संख्या दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('B2:D5');
Logger.log(range.getNumColumns());

वापसी का टिकट

Integer — इस रेंज में कॉलम की संख्या.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getNumRows()

यह फ़ंक्शन, इस रेंज में मौजूद पंक्तियों की संख्या दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('B2:D5');
Logger.log(range.getNumRows());

वापसी का टिकट

Integer — इस रेंज में मौजूद लाइनों की संख्या.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getNumberFormat()

इस फ़ंक्शन की मदद से, दी गई रेंज की सबसे ऊपर बाईं ओर मौजूद सेल की संख्या या तारीख की फ़ॉर्मैटिंग मिलती है. Sheets API के दस्तावेज़ में, फ़ॉर्मैट पैटर्न के बारे में बताया गया है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('C4');
Logger.log(cell.getNumberFormat());

वापसी का टिकट

String — यह रेंज के सबसे ऊपर मौजूद बाएं सेल का नंबर फ़ॉर्मैट है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getNumberFormats()

यह फ़ंक्शन, रेंज में मौजूद सेल के लिए संख्या या तारीख के फ़ॉर्मैट दिखाता है. जवाब में मिले फ़ॉर्मैट पैटर्न के बारे में, Sheets API के दस्तावेज़ में बताया गया है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('B5:C6');
const formats = range.getNumberFormats();
for (const i in formats) {
  for (const j in formats[i]) {
    Logger.log(formats[i][j]);
  }
}

वापसी का टिकट

String[][] — यह संख्या के फ़ॉर्मैट का दो डाइमेंशन वाला कलेक्शन होता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getRichTextValue()

यह फ़ंक्शन, रेंज की सबसे ऊपर बाईं ओर मौजूद सेल के लिए रिच टेक्स्ट वैल्यू दिखाता है. अगर सेल की वैल्यू टेक्स्ट नहीं है, तो यह null दिखाता है.

// Gets the Rich Text value of cell D4.
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange('D4:F6');
const richText = range.getRichTextValue();
console.log(richText.getText());

वापसी का टिकट

RichTextValue — रेंज में सबसे ऊपर बाईं ओर मौजूद सेल की रिच टेक्स्ट वैल्यू या null, अगर सेल की वैल्यू टेक्स्ट नहीं है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getRichTextValues()

यह फ़ंक्शन, रेंज में मौजूद सेल के लिए रिच टेक्स्ट वैल्यू दिखाता है.

// Gets the Rich Text values for all cells in range B5:C6
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange('B5:C6');
const values = range.getRichTextValues();

for (let i = 0; i < values.length; i++) {
  for (let j = 0; j < values[i].length; j++) {
    console.log(values[i][j].getText());
  }
}

वापसी का टिकट

RichTextValue[][] — रिच टेक्स्ट वैल्यू का दो डाइमेंशन वाला कलेक्शन.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getRow()

यह फ़ंक्शन, इस रेंज के लिए लाइन की पोज़िशन दिखाता है. यह getRowIndex() के जैसा ही है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('B2');
Logger.log(range.getRow());

वापसी का टिकट

Integer — रेंज की लाइन की पोज़िशन.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getRowIndex()

यह फ़ंक्शन, इस रेंज के लिए लाइन की पोज़िशन दिखाता है. यह getRow() के जैसा ही है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('B2');
Logger.log(range.getRowIndex());

वापसी का टिकट

Integer — रेंज की लाइन की पोज़िशन.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

इन्हें भी देखें


getSheet()

यह फ़ंक्शन, उस शीट को दिखाता है जिससे यह रेंज जुड़ी है.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets the range A1:D10 on Sheet1.
const range = sheet.getRange('A1:D10');

// Gets the sheet that the range belongs to.
const rangeSheet = range.getSheet();

// Gets the sheet name and logs it to the console.
console.log(rangeSheet.getName());

वापसी का टिकट

Sheet — यह रेंज जिस शीट से जुड़ी है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getTextDirection()

यह फ़ंक्शन, रेंज के सबसे ऊपर मौजूद बाएं सेल के लिए टेक्स्ट की दिशा दिखाता है. अगर सेल के टेक्स्ट की दिशा का पता अपने-आप लगाने की सुविधा से चलता है, तो यह फ़ंक्शन null दिखाता है.

// Get the text direction of cell B1.
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange('B1:D4');
Logger.log(range.getTextDirection());

वापसी का टिकट

TextDirection — रेंज में सबसे ऊपर मौजूद बाएं सेल के टेक्स्ट की दिशा.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getTextDirections()

इस फ़ंक्शन की मदद से, रेंज में मौजूद सेल के लिए टेक्स्ट की दिशाएं मिलती हैं. 2D ऐरे में मौजूद एंट्री, अपने-आप पहचान करने की सुविधा का इस्तेमाल करने वाली सेल के लिए null होती हैं.

// Get the text directions for all cells in range B5:C6
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange('B5:C6');
const directions = range.getTextDirections();

for (let i = 0; i < directions.length; i++) {
  for (let j = 0; j < directions[i].length; j++) {
    Logger.log(directions[i][j]);
  }
}

वापसी का टिकट

TextDirection[][] — यह टेक्स्ट की दिशाओं का दो डाइमेंशन वाला ऐरे होता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getTextRotation()

यह फ़ंक्शन, रेंज में मौजूद सबसे ऊपर बाईं ओर वाले सेल के लिए, टेक्स्ट रोटेशन की सेटिंग दिखाता है.

// Log the text rotation settings for a cell.
const sheet = SpreadsheetApp.getActiveSheet();

const cell = sheet.getRange('A1');
Logger.log(cell.getTextRotation());

वापसी का टिकट

TextRotation — टेक्स्ट रोटेशन की सेटिंग.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getTextRotations()

इस फ़ंक्शन की मदद से, रेंज में मौजूद सेल के लिए टेक्स्ट रोटेशन की सेटिंग मिलती हैं.

const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange('B2:D4');

const results = range.getTextRotations();

for (const i in results) {
  for (const j in results[i]) {
    const rotation = results[i][j];
    Logger.log('Cell [%s, %s] has text rotation: %v', i, j, rotation);
  }
}

वापसी का टिकट

TextRotation[][] — यह रेंज में मौजूद सेल से जुड़े टेक्स्ट रोटेशन का दो डाइमेंशन वाला अरे होता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getTextStyle()

यह फ़ंक्शन, रेंज के सबसे ऊपर मौजूद बाएं सेल के लिए टेक्स्ट स्टाइल दिखाता है.

// Get the text style of cell D4.
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange('D4:F6');
const style = range.getTextStyle();
Logger.log(style);

वापसी का टिकट

TextStyle — रेंज में सबसे ऊपर मौजूद बाएं सेल का टेक्स्ट स्टाइल.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getTextStyles()

इस फ़ंक्शन की मदद से, रेंज में मौजूद सेल के लिए टेक्स्ट स्टाइल मिलती हैं.

// Get the text styles for all cells in range B5:C6
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange('B5:C6');
const styles = range.getTextStyles();

for (let i = 0; i < styles.length; i++) {
  for (let j = 0; j < styles[i].length; j++) {
    Logger.log(styles[i][j]);
  }
}

वापसी का टिकट

TextStyle[][] — यह टेक्स्ट स्टाइल का दो डाइमेंशन वाला ऐरे होता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getValue()

यह फ़ंक्शन, रेंज में सबसे ऊपर मौजूद बाएं सेल की वैल्यू दिखाता है. सेल की वैल्यू के आधार पर, वैल्यू Number, Boolean, Date या String टाइप की हो सकती है. खाली सेल, एक खाली स्ट्रिंग दिखाता है.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets the range A1:D10 on Sheet1.
const range = sheet.getRange('A1:D10');

// Gets the value of the top-left cell in the range and logs it to the console.
console.log(range.getValue());

वापसी का टिकट

Object — इस सेल में मौजूद वैल्यू.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getValues()

यह फ़ंक्शन, इस रेंज के लिए वैल्यू का आयताकार ग्रिड दिखाता है.

यह फ़ंक्शन, वैल्यू का दो डाइमेंशन वाला ऐरे दिखाता है. इसमें इंडेक्सिंग, पहले पंक्ति के हिसाब से और फिर कॉलम के हिसाब से की जाती है. सेल की वैल्यू के आधार पर, वैल्यू Number, Boolean, Date या String टाइप की हो सकती हैं. खाली सेल को कैटगरी में, खाली स्ट्रिंग के तौर पर दिखाया जाता है. ध्यान दें कि रेंज इंडेक्स 1, 1 से शुरू होता है, जबकि JavaScript कैटगरी को [0][0] से इंडेक्स किया जाता है.

// The code below gets the values for the range C2:G8
// in the active spreadsheet.  Note that this is a JavaScript array.
const values = SpreadsheetApp.getActiveSheet().getRange(2, 3, 6, 4).getValues();
Logger.log(values[0][0]);
वेब ऐप्लिकेशन में, Date वैल्यू एक मान्य पैरामीटर नहीं है. अगर रेंज में Date वैल्यू वाला कोई सेल मौजूद है, तो getValues() वेब ऐप्लिकेशन को डेटा नहीं दिखा पाता. इसके बजाय, शीट से मिली सभी वैल्यू को JavaScript के साथ काम करने वाले प्रिमिटिव में बदलें. जैसे, Number, Boolean या String.

वापसी का टिकट

Object[][] — वैल्यू की दो डाइमेंशन वाली सरणी.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getVerticalAlignment()

यह फ़ंक्शन, रेंज के सबसे ऊपर मौजूद बाएं कोने वाली सेल का वर्टिकल अलाइनमेंट (सबसे ऊपर/बीच में/सबसे नीचे) दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

Logger.log(range.getVerticalAlignment());

वापसी का टिकट

String — सेल में मौजूद टेक्स्ट का वर्टिकल अलाइनमेंट.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getVerticalAlignments()

यह फ़ंक्शन, रेंज में मौजूद सेल के वर्टिकल अलाइनमेंट दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

const results = range.getVerticalAlignments();

for (const i in results) {
  for (const j in results[i]) {
    Logger.log(results[i][j]);
  }
}

वापसी का टिकट

String[][] — यह रेंज में मौजूद सेल से जुड़े टेक्स्ट के वर्टिकल अलाइनमेंट का दो डाइमेंशन वाला कलेक्शन होता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getWidth()

यह फ़ंक्शन, कॉलम में मौजूद रेंज की चौड़ाई दिखाता है.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets the range A1:D10 on Sheet1.
const range = sheet.getRange('A1:D10');

// Gets the width of the range in number of columns and logs it to the console.
console.log(range.getWidth());

वापसी का टिकट

Integer — रेंज में मौजूद कॉलम की संख्या.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getWrap()

इससे यह पता चलता है कि सेल में मौजूद टेक्स्ट रैप होता है या नहीं. ज़्यादा सटीक रैप रणनीति के लिए, getWrapStrategy() का इस्तेमाल करें.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

Logger.log(range.getWrap());

वापसी का टिकट

Boolean — इस सेल में मौजूद टेक्स्ट रैप होता है या नहीं.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getWrapStrategies()

इस फ़ंक्शन की मदद से, रेंज में मौजूद सेल के लिए टेक्स्ट रैपिंग की रणनीतियां मिलती हैं.

// Get the text wrapping strategies for all cells in range B5:C6
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange('B5:C6');
const strategies = range.getWrapStrategies();

for (let i = 0; i < strategies.length; i++) {
  for (let j = 0; j < strategies[i].length; j++) {
    Logger.log(strategies[i][j]);
  }
}

वापसी का टिकट

WrapStrategy[][] — यह टेक्स्ट रैपिंग की रणनीतियों का दो डाइमेंशन वाला कलेक्शन होता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getWrapStrategy()

यह फ़ंक्शन, रेंज में सबसे ऊपर मौजूद बाएं सेल के लिए, टेक्स्ट रैपिंग की रणनीति दिखाता है.

// Get the text wrapping strategy of cell B1.
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange('B1:D4');
Logger.log(range.getWrapStrategy());

वापसी का टिकट

WrapStrategy — रेंज में सबसे ऊपर मौजूद बाएं सेल के लिए, टेक्स्ट रैपिंग की रणनीति.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getWraps()

इससे यह पता चलता है कि सेल में मौजूद टेक्स्ट रैप होता है या नहीं. ज़्यादा सटीक रैप रणनीति के लिए, getWrapStrategies() का इस्तेमाल करें.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

const results = range.getVerticalAlignments();

for (const i in results) {
  for (const j in results[i]) {
    const isWrapped = results[i][j];
    if (isWrapped) {
      Logger.log('Cell [%s, %s] has wrapped text', i, j);
    }
  }
}

वापसी का टिकट

Boolean[][] — यह रेंज में मौजूद सेल से जुड़े टेक्स्ट के वर्टिकल अलाइनमेंट का दो डाइमेंशन वाला कलेक्शन होता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

insertCells(shiftDimension)

इस रेंज में खाली सेल शामिल करता है. नई सेल में, इस रेंज में पहले से मौजूद सेल की फ़ॉर्मैटिंग बरकरार रहती है. शीट में मौजूद मौजूदा डेटा, दिए गए डाइमेंशन के साथ, डाली गई रेंज से दूर चला जाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('A1:D10');
range.insertCells(SpreadsheetApp.Dimension.COLUMNS);

पैरामीटर

नामटाइपब्यौरा
shiftDimensionDimensionवह डाइमेंशन जिसके हिसाब से मौजूदा डेटा को शिफ़्ट करना है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

insertCheckboxes()

यह फ़ंक्शन, रेंज की हर सेल में चेकबॉक्स डालता है. इसमें true को चुने गए और false को नहीं चुने गए के तौर पर कॉन्फ़िगर किया जाता है. इस फ़ंक्शन की मदद से, रेंज में मौजूद सभी सेल की वैल्यू को false पर सेट किया जाता है.

const range = SpreadsheetApp.getActive().getRange('A1:B10');

// Inserts checkboxes into each cell in the range A1:B10 configured with 'true'
// for checked and 'false' for unchecked. Also, sets the value of each cell in
// the range A1:B10 to 'false'.
range.insertCheckboxes();

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

insertCheckboxes(checkedValue)

यह फ़ंक्शन, रेंज की हर सेल में चेकबॉक्स डालता है. इसमें, चुने गए चेकबॉक्स के लिए कस्टम वैल्यू और न चुने गए चेकबॉक्स के लिए खाली स्ट्रिंग कॉन्फ़िगर की जाती है. इस फ़ंक्शन का इस्तेमाल करके, रेंज में मौजूद हर सेल की वैल्यू को खाली स्ट्रिंग पर सेट किया जाता है.

const range = SpreadsheetApp.getActive().getRange('A1:B10');

// Inserts checkboxes into each cell in the range A1:B10 configured with 'yes'
// for checked and the empty string for unchecked. Also, sets the value of each
// cell in the range A1:B10 to
//  the empty string.
range.insertCheckboxes('yes');

पैरामीटर

नामटाइपब्यौरा
checkedValueObjectचेकबॉक्स के लिए, डेटा की पुष्टि करने से जुड़ी सेटिंग में 'चुना गया' वैल्यू.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

insertCheckboxes(checkedValue, uncheckedValue)

यह फ़ंक्शन, रेंज की हर सेल में चेकबॉक्स डालता है. इन चेकबॉक्स को, चुने गए और नहीं चुने गए स्टेटस के लिए कस्टम वैल्यू के साथ कॉन्फ़िगर किया जाता है. इस फ़ंक्शन की मदद से, रेंज में मौजूद हर सेल की वैल्यू को, कस्टम तौर पर चुनी गई ऐसी वैल्यू पर सेट किया जाता है जिसे चुना नहीं गया है.

const range = SpreadsheetApp.getActive().getRange('A1:B10');

// Inserts checkboxes into each cell in the range A1:B10 configured with 'yes'
// for checked and 'no' for unchecked. Also, sets the value of each cell in the
// range A1:B10 to 'no'.
range.insertCheckboxes('yes', 'no');

पैरामीटर

नामटाइपब्यौरा
checkedValueObjectचेकबॉक्स के लिए, डेटा की पुष्टि करने से जुड़ी सेटिंग में 'चुना गया' वैल्यू.
uncheckedValueObjectचेकबॉक्स के डेटा की पुष्टि करने के लिए, 'नहीं चुना गया' वैल्यू.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

isBlank()

अगर रेंज पूरी तरह से खाली है, तो true दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');

Logger.log(range.isBlank());

वापसी का टिकट

Boolean — अगर रेंज खाली है, तो true; अगर रेंज खाली नहीं है, तो false.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

isChecked()

यह फ़ंक्शन बताता है कि रेंज में मौजूद सभी सेल में चेकबॉक्स की स्थिति 'चुना गया' के तौर पर सेट है या नहीं. अगर कुछ सेल पर सही का निशान लगा है और कुछ पर नहीं या कुछ सेल में चेकबॉक्स वाला डेटा पुष्टि करने का नियम लागू नहीं है, तो null वैल्यू मिलती है.

const range = SpreadsheetApp.getActive().getRange('A1:A3');

// Inserts checkboxes and sets each cell value to 'no' in the range A1:A3.
range.insertCheckboxes('yes', 'no');

const range1 = SpreadsheetApp.getActive().getRange('A1');
range1.setValue('yes');
// Sets the value of isRange1Checked as true as it contains the checked value.
const isRange1Checked = range1.isChecked();

const range2 = SpreadsheetApp.getActive().getRange('A2');
range2.setValue('no');
// Sets the value of isRange2Checked as false as it contains the unchecked
// value.
const isRange2Checked = range2.isChecked();

const range3 = SpreadsheetApp.getActive().getRange('A3');
range3.setValue('random');
// Sets the value of isRange3Checked as null, as it contains an invalid checkbox
// value.
const isRange3Checked = range3.isChecked();

वापसी का टिकट

Booleantrue, अगर रेंज की सभी सेल चुने गए हैं, false अगर रेंज की सभी सेल नहीं चुने गए हैं या null अगर कोई भी सेल नहीं चुना गया है या उसमें चेकबॉक्स डेटा की पुष्टि करने की सुविधा नहीं है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

isEndColumnBounded()

इससे यह तय होता है कि रेंज का आखिरी हिस्सा किसी कॉलम से जुड़ा है या नहीं. उदाहरण के लिए, रेंज के आखिर में मौजूद कॉलम से बंधी हुई रेंज A1:B10 या B:B के लिए, यह तरीका true दिखाता है. वहीं, रेंज के आखिर में मौजूद सिर्फ़ कुछ लाइनों से बंधी हुई रेंज 3:7 या A1:5 के लिए, यह तरीका false दिखाता है.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets the range A1:D10 on Sheet1.
const range = sheet.getRange('A1:D10');

// Determines if the end of the range is bound to a particular column and logs
// it to the console.
console.log(range.isEndColumnBounded());

वापसी का टिकट

Booleantrue अगर रेंज का आखिरी हिस्सा किसी कॉलम से जुड़ा है; false अन्यथा.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

isEndRowBounded()

इससे यह तय होता है कि रेंज का आखिरी हिस्सा किसी खास लाइन से जुड़ा है या नहीं. उदाहरण के लिए, A1:B10 या 3:7 रेंज के लिए, यह तरीका true दिखाता है. ये रेंज, रेंज के आखिर में मौजूद लाइनों से जुड़ी होती हैं. वहीं, B:B या A1:C रेंज के लिए, यह तरीका false दिखाता है. ये रेंज, रेंज के आखिर में मौजूद खास कॉलम से जुड़ी होती हैं.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets the range A1:D10 on Sheet1.
const range = sheet.getRange('A1:D10');

// Determines if the end of the range is bound to a particular row and logs it
// to the console.
console.log(range.isEndRowBounded());

वापसी का टिकट

Booleantrue अगर रेंज का आखिरी हिस्सा किसी खास लाइन से जुड़ा है; false अन्यथा.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

isPartOfMerge()

अगर मौजूदा रेंज में मौजूद सेल, मर्ज की गई किसी सेल से ओवरलैप होती हैं, तो true दिखाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('A1:B3');

// True if any of the cells in A1:B3 is included in a merge.
const isPartOfMerge = range.isPartOfMerge();

वापसी का टिकट

Boolean — अगर रेंज, मर्ज किए गए किसी सेल से ओवरलैप होती है, तो true दिखाता है. ऐसा न होने पर, false दिखाता है.


isStartColumnBounded()

इस विकल्प से यह तय होता है कि रेंज की शुरुआत किसी कॉलम से बंधी है या नहीं. उदाहरण के लिए, A1:B10 या B:B रेंज के लिए, यह तरीका true दिखाता है. ये रेंज, रेंज की शुरुआत में मौजूद कॉलम से जुड़ी होती हैं. वहीं, 3:7 रेंज के लिए, यह तरीका false दिखाता है. यह रेंज, रेंज की शुरुआत में मौजूद सिर्फ़ एक लाइन से जुड़ी होती है.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets the range A1:D10 on Sheet1.
const range = sheet.getRange('A1:D10');

// Determines if the start of the range is bound to a particular column and logs
// it to the console.
console.log(range.isStartColumnBounded());

वापसी का टिकट

Boolean — अगर रेंज की शुरुआत किसी कॉलम से होती है, तो true; false अन्यथा.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

isStartRowBounded()

इससे यह तय होता है कि रेंज की शुरुआत किसी खास लाइन से जुड़ी है या नहीं. उदाहरण के लिए, A1:B10 या 3:7 रेंज के लिए, यह तरीका true दिखाता है. ये रेंज, रेंज की शुरुआत में मौजूद लाइनों से जुड़ी होती हैं. वहीं, B:B रेंज के लिए, यह तरीका false दिखाता है. यह रेंज, रेंज की शुरुआत में मौजूद किसी कॉलम से जुड़ी होती है.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets the range A1:D10 on Sheet1.
const range = sheet.getRange('A1:D10');

// Determines if the start of the range is bound to a particular row and logs it
// to the console.
console.log(range.isStartRowBounded());

वापसी का टिकट

Boolean — अगर रेंज की शुरुआत किसी खास लाइन से बंधी है, तो true; false अन्यथा.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

merge()

यह फ़ंक्शन, रेंज में मौजूद सेल को एक साथ मिलाकर एक ब्लॉक बना देता है.

const sheet = SpreadsheetApp.getActiveSheet();

// The code below 2-dimensionally merges the cells in A1 to B3
sheet.getRange('A1:B3').merge();

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

mergeAcross()

रेंज के कॉलम में मौजूद सेल को मर्ज करता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

// The code below merges cells C5:E5 into one cell
const range1 = sheet.getRange('C5:E5');
range1.mergeAcross();

// The code below creates 2 horizontal cells, F5:H5 and F6:H6
const range2 = sheet.getRange('F5:H6');
range2.mergeAcross();

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

mergeVertically()

यह फ़ंक्शन, रेंज में मौजूद सेल को एक साथ मर्ज करता है.

const sheet = SpreadsheetApp.getActiveSheet();

// The code below vertically merges the cells in A1 to A10
sheet.getRange('A1:A10').mergeVertically();

// The code below creates 3 merged columns: B1 to B10, C1 to C10, and D1 to D10
sheet.getRange('B1:D10').mergeVertically();

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

moveTo(target)

इस रेंज से टारगेट रेंज में, कट और चिपकाएं. इसमें फ़ॉर्मैट और वैल्यू, दोनों शामिल हैं.

// The code below moves the first 5 columns over to the 6th column
const sheet = SpreadsheetApp.getActiveSheet();
sheet.getRange('A1:E').moveTo(sheet.getRange('F1'));

पैरामीटर

नामटाइपब्यौरा
targetRangeयह वह टारगेट रेंज है जिसमें इस रेंज को कॉपी करना है. इसमें सिर्फ़ सबसे ऊपर बाईं ओर मौजूद सेल की पोज़िशन काम की होती है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

offset(rowOffset, columnOffset)

यह फ़ंक्शन, एक नई रेंज दिखाता है. यह रेंज, दी गई पंक्तियों और कॉलम की संख्या के हिसाब से इस रेंज से ऑफ़सेट होती है. पंक्तियों और कॉलम की संख्या नेगेटिव भी हो सकती है. नई रेंज का साइज़, ओरिजनल रेंज के साइज़ के बराबर होता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('A1');

// newCell references B2
const newCell = cell.offset(1, 1);

पैरामीटर

नामटाइपब्यौरा
rowOffsetIntegerयह रेंज की सबसे ऊपर मौजूद बाईं ओर की सेल से नीचे की ओर मौजूद पंक्तियों की संख्या होती है. नेगेटिव वैल्यू, रेंज की सबसे ऊपर मौजूद बाईं ओर की सेल से ऊपर की ओर मौजूद पंक्तियों को दिखाती हैं.
columnOffsetIntegerयह रेंज की सबसे ऊपर मौजूद बाईं ओर की सेल से दाईं ओर मौजूद कॉलम की संख्या होती है. नेगेटिव वैल्यू, रेंज की सबसे ऊपर मौजूद बाईं ओर की सेल से बाईं ओर मौजूद कॉलम को दिखाती हैं.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.


offset(rowOffset, columnOffset, numRows)

यह फ़ंक्शन, मौजूदा रेंज के हिसाब से एक नई रेंज दिखाता है. इस नई रेंज का सबसे ऊपर मौजूद बायां पॉइंट, मौजूदा रेंज से दी गई पंक्तियों और कॉलम के हिसाब से ऑफ़सेट होता है. साथ ही, इसकी ऊंचाई, सेल में दी गई ऊंचाई के बराबर होती है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('A1');

// newCell references B2:B3
const newRange = cell.offset(1, 1, 2);

पैरामीटर

नामटाइपब्यौरा
rowOffsetIntegerयह रेंज की सबसे ऊपर मौजूद बाईं ओर की सेल से नीचे की ओर मौजूद पंक्तियों की संख्या होती है. नेगेटिव वैल्यू, रेंज की सबसे ऊपर मौजूद बाईं ओर की सेल से ऊपर की ओर मौजूद पंक्तियों को दिखाती हैं.
columnOffsetIntegerयह रेंज की सबसे ऊपर मौजूद बाईं ओर की सेल से दाईं ओर मौजूद कॉलम की संख्या होती है. नेगेटिव वैल्यू, रेंज की सबसे ऊपर मौजूद बाईं ओर की सेल से बाईं ओर मौजूद कॉलम को दिखाती हैं.
numRowsIntegerनई रेंज की ऊंचाई, पंक्तियों में.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.


offset(rowOffset, columnOffset, numRows, numColumns)

यह फ़ंक्शन, मौजूदा रेंज के हिसाब से एक नई रेंज दिखाता है. इस नई रेंज का ऊपरी-बायां कोना, मौजूदा रेंज के ऊपरी-बाएं कोने से दी गई पंक्तियों और कॉलम की संख्या के हिसाब से ऑफ़सेट होता है. साथ ही, इसकी ऊंचाई और चौड़ाई, सेल में दी गई ऊंचाई और चौड़ाई के बराबर होती है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('A1');

// newCell references B2:C3
const newRange = cell.offset(1, 1, 2, 2);

पैरामीटर

नामटाइपब्यौरा
rowOffsetIntegerयह रेंज की सबसे ऊपर मौजूद बाईं ओर की सेल से नीचे की ओर मौजूद पंक्तियों की संख्या होती है. नेगेटिव वैल्यू, रेंज की सबसे ऊपर मौजूद बाईं ओर की सेल से ऊपर की ओर मौजूद पंक्तियों को दिखाती हैं.
columnOffsetIntegerयह रेंज की सबसे ऊपर मौजूद बाईं ओर की सेल से दाईं ओर मौजूद कॉलम की संख्या होती है. नेगेटिव वैल्यू, रेंज की सबसे ऊपर मौजूद बाईं ओर की सेल से बाईं ओर मौजूद कॉलम को दिखाती हैं.
numRowsIntegerनई रेंज की ऊंचाई, पंक्तियों में.
numColumnsIntegerनई रेंज की चौड़ाई, कॉलम में.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.


protect()

यह एक ऐसा ऑब्जेक्ट बनाता है जो रेंज को उन उपयोगकर्ताओं के अलावा किसी और से बदलाव करने से सुरक्षित रख सकता है जिनके पास अनुमति है. जब तक स्क्रिप्ट, रेंज के लिए संपादकों की सूची में बदलाव नहीं करती (Protection.removeEditor(emailAddress), Protection.removeEditor(user), Protection.removeEditors(emailAddresses), Protection.addEditor(emailAddress), Protection.addEditor(user), Protection.addEditors(emailAddresses) को कॉल करके या Protection.setDomainEdit(editable) के लिए नई वैल्यू सेट करके), तब तक अनुमतियां स्प्रेडशीट की अनुमतियों के जैसी ही होती हैं. इसका मतलब है कि रेंज को सुरक्षित नहीं किया गया है. अगर रेंज पहले से ही सुरक्षित है, तो यह तरीका सुरक्षित की गई एक नई रेंज बनाता है. यह नई रेंज, मौजूदा रेंज पर ओवरलैप करती है. अगर किसी सेल को सुरक्षित की गई कई रेंज से सुरक्षित किया गया है और उनमें से कोई भी रेंज किसी उपयोगकर्ता को सेल में बदलाव करने से रोकती है, तो उस उपयोगकर्ता को सेल में बदलाव करने की अनुमति नहीं दी जाती.

// Protect range A1:B10, then remove all other users from the list of editors.
const ss = SpreadsheetApp.getActive();
const range = ss.getRange('A1:B10');
const protection = range.protect().setDescription('Sample protected range');

// Ensure the current user is an editor before removing others. Otherwise, if
// the user's edit permission comes from a group, the script throws an exception
// upon removing the group.
const me = Session.getEffectiveUser();
protection.addEditor(me);
protection.removeEditors(protection.getEditors());
if (protection.canDomainEdit()) {
  protection.setDomainEdit(false);
}

वापसी का टिकट

Protection — सुरक्षा सेटिंग दिखाने वाला ऑब्जेक्ट.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

randomize()

यह फ़ंक्शन, दी गई रेंज में मौजूद पंक्तियों के क्रम को बदल देता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('A1:C7');

// Randomizes the range
range.randomize();

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

removeCheckboxes()

इस फ़ंक्शन की मदद से, रेंज से सभी चेकबॉक्स हटाए जाते हैं. इससे हर सेल में डेटा की पुष्टि करने की सुविधा बंद हो जाती है. साथ ही, अगर सेल में चुनी गई या नहीं चुनी गई वैल्यू मौजूद है, तो उसे भी मिटा दिया जाता है.

const range = SpreadsheetApp.getActive().getRange('A1:B10');

// Inserts checkboxes and sets each cell value to 'no' in the range A1:B10.
range.insertCheckboxes('yes', 'no');

const range1 = SpreadsheetApp.getActive().getRange('A1');
range1.setValue('yes');
// Removes the checkbox data validation in cell A1 and clears its value.
range1.removeCheckboxes();

const range2 = SpreadsheetApp.getActive().getRange('A2');
range2.setValue('random');
// Removes the checkbox data validation in cell A2 but does not clear its value.
range2.removeCheckboxes();

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

removeDuplicates()

इस रेंज में मौजूद उन लाइनों को हटाता है जिनमें ऐसी वैल्यू होती हैं जो किसी पिछली लाइन में मौजूद वैल्यू की डुप्लीकेट होती हैं. एक जैसी वैल्यू वाली पंक्तियां डुप्लीकेट मानी जाती हैं. भले ही, उनमें फ़ॉर्मूला, फ़ॉर्मैट या अक्षर के साइज़ अलग-अलग हों. इस तरीके से, डुप्लीकेट पंक्तियों को भी हटाया जाता है. ये पंक्तियां, फ़िल्टर की वजह से छिपी होती हैं और दिखती नहीं हैं. इस रेंज के बाहर मौजूद कॉन्टेंट नहीं हटाया जाता.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B1:D7');

// Remove duplicate rows in the range.
range.removeDuplicates();

वापसी का टिकट

Range — डुप्लीकेट वैल्यू हटाने के बाद मिली रेंज. हर पंक्ति को हटाने पर, रेंज का साइज़ एक पंक्ति कम हो जाता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

removeDuplicates(columnsToCompare)

इस रेंज में मौजूद उन लाइनों को हटाता है जिनमें डुप्लीकेट वैल्यू होती हैं. डुप्लीकेट वैल्यू, पहले की किसी लाइन में मौजूद वैल्यू की डुप्लीकेट होती हैं. एक जैसी वैल्यू वाली पंक्तियां डुप्लीकेट मानी जाती हैं. भले ही, उनमें फ़ॉर्मूला, फ़ॉर्मैट या अक्षर के साइज़ अलग-अलग हों. इस तरीके से, छिपी हुई डुप्लीकेट पंक्तियां भी हट जाती हैं. उदाहरण के लिए, फ़िल्टर की वजह से छिपी हुई पंक्तियां. इस रेंज के बाहर मौजूद कॉन्टेंट नहीं हटाया जाता.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B1:D7');

// Remove rows which have duplicate values in column B.
range.removeDuplicates([2]);

// Remove rows which have duplicate values in both columns B and D.
range.removeDuplicates([2, 4]);

पैरामीटर

नामटाइपब्यौरा
columnsToCompareInteger[]डुप्लीकेट वैल्यू का पता लगाने के लिए, इन कॉलम का विश्लेषण किया जाता है. अगर कोई कॉलम नहीं दिया गया है, तो डुप्लीकेट वैल्यू के लिए सभी कॉलम का विश्लेषण किया जाता है.

वापसी का टिकट

Range — डुप्लीकेट वैल्यू हटाने के बाद मिली रेंज. हर पंक्ति को हटाने पर, रेंज का साइज़ एक पंक्ति कम हो जाता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setBackground(color)

इस विकल्प से, सीएसएस नोटेशन में रेंज की सभी सेल के बैकग्राउंड का रंग सेट किया जाता है. जैसे, '#ffffff' या 'white'.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const range = sheet.getRange('B2:D5');
range.setBackground('red');

पैरामीटर

नामटाइपब्यौरा
colorStringसीएसएस नोटेशन में कलर कोड (जैसे, '#ffffff' या 'white'); null वैल्यू से रंग रीसेट हो जाता है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setBackgroundObject(color)

इस विकल्प का इस्तेमाल करके, रेंज में मौजूद सभी सेल के बैकग्राउंड का रंग सेट किया जाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const bgColor = SpreadsheetApp.newColor()
                    .setThemeColor(SpreadsheetApp.ThemeColorType.BACKGROUND)
                    .build();

const range = sheet.getRange('B2:D5');
range.setBackgroundObject(bgColor);

पैरामीटर

नामटाइपब्यौरा
colorColorसेट करने के लिए बैकग्राउंड का रंग; null वैल्यू, बैकग्राउंड के रंग को रीसेट करती है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setBackgroundObjects(color)

बैकग्राउंड के रंगों की आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const colorAccent1 = SpreadsheetApp.newColor()
                         .setThemeColor(SpreadsheetApp.ThemeColorType.ACCENT1)
                         .build();
const colorAccent2 = SpreadsheetApp.newColor()
                         .setThemeColor(SpreadsheetApp.ThemeColorType.ACCENT2)
                         .build();
const colorAccent3 = SpreadsheetApp.newColor()
                         .setThemeColor(SpreadsheetApp.ThemeColorType.ACCENT3)
                         .build();
const colorAccent4 = SpreadsheetApp.newColor()
                         .setThemeColor(SpreadsheetApp.ThemeColorType.ACCENT4)
                         .build();

const colors = [
  [colorAccent1, colorAccent2],
  [colorAccent3, colorAccent4],
];

const cell = sheet.getRange('B5:C6');
cell.setBackgroundObjects(colors);

पैरामीटर

नामटाइपब्यौरा
colorColor[][]यह रंगों का दो डाइमेंशन वाला कलेक्शन होता है. null वैल्यू से रंग रीसेट हो जाता है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setBackgroundRGB(red, green, blue)

इस विकल्प का इस्तेमाल करके, आरजीबी वैल्यू (0 से 255 के बीच के पूर्णांक) का इस्तेमाल करके, बैकग्राउंड को दिए गए रंग पर सेट किया जाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B2');

// Sets the background to white
cell.setBackgroundRGB(255, 255, 255);

// Sets the background to red
cell.setBackgroundRGB(255, 0, 0);

पैरामीटर

नामटाइपब्यौरा
redIntegerआरजीबी नोटेशन में लाल रंग की वैल्यू.
greenIntegerआरजीबी नोटेशन में हरे रंग की वैल्यू.
blueIntegerआरजीबी नोटेशन में नीले रंग की वैल्यू.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setBackgrounds(color)

बैकग्राउंड के रंगों की आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए. रंग, सीएसएस नोटेशन में हैं. जैसे, '#ffffff' या 'white'.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const colors = [
  ['red', 'white', 'blue'],
  ['#FF0000', '#FFFFFF', '#0000FF'],  // These are the hex equivalents
];

const cell = sheet.getRange('B5:D6');
cell.setBackgrounds(colors);

पैरामीटर

नामटाइपब्यौरा
colorString[][]सीएसएस नोटेशन में रंगों का दो डाइमेंशनल ऐरे (जैसे, '#ffffff' या 'white'); null वैल्यू, रंग को रीसेट करती हैं.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setBorder(top, left, bottom, right, vertical, horizontal)

बॉर्डर प्रॉपर्टी सेट करता है. मान्य वैल्यू true (चालू है), false (बंद है), और null (कोई बदलाव नहीं) हैं.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B2');
// Sets borders on the top and bottom, but leaves the left and right unchanged
cell.setBorder(true, null, true, null, false, false);

पैरामीटर

नामटाइपब्यौरा
topBooleanबॉर्डर के लिए true, किसी के लिए नहीं के लिए false, और कोई बदलाव नहीं के लिए null.
leftBooleanबॉर्डर के लिए true, किसी के लिए नहीं के लिए false, और कोई बदलाव नहीं के लिए null.
bottomBooleanबॉर्डर के लिए true, किसी के लिए नहीं के लिए false, और कोई बदलाव नहीं के लिए null.
rightBooleanबॉर्डर के लिए true, किसी के लिए नहीं के लिए false, और कोई बदलाव नहीं के लिए null.
verticalBooleantrue का इस्तेमाल अंदरूनी वर्टिकल बॉर्डर के लिए, false का इस्तेमाल किसी भी बॉर्डर के लिए नहीं, और null का इस्तेमाल कोई बदलाव न करने के लिए किया जाता है.
horizontalBooleantrue का इस्तेमाल अंदरूनी हॉरिज़ॉन्टल बॉर्डर के लिए, false का इस्तेमाल किसी भी बॉर्डर के लिए नहीं, और null का इस्तेमाल कोई बदलाव न करने के लिए किया जाता है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setBorder(top, left, bottom, right, vertical, horizontal, color, style)

इस विकल्प की मदद से, बॉर्डर की प्रॉपर्टी को रंग और/या स्टाइल के साथ सेट किया जाता है. मान्य वैल्यू true (चालू है), false (बंद है), और null (कोई बदलाव नहीं) हैं. रंग के लिए, सीएसएस नोटेशन में रंग का इस्तेमाल करें. जैसे, '#ffffff' या 'white'.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B2');
// Sets borders on the top and bottom, but leaves the left and right unchanged
// Also sets the color to "red", and the border to "DASHED".
cell.setBorder(
    true,
    null,
    true,
    null,
    false,
    false,
    'red',
    SpreadsheetApp.BorderStyle.DASHED,
);

पैरामीटर

नामटाइपब्यौरा
topBooleanबॉर्डर के लिए true, किसी के लिए नहीं के लिए false, और कोई बदलाव नहीं के लिए null.
leftBooleanबॉर्डर के लिए true, किसी के लिए नहीं के लिए false, और कोई बदलाव नहीं के लिए null.
bottomBooleanबॉर्डर के लिए true, किसी के लिए नहीं के लिए false, और कोई बदलाव नहीं के लिए null.
rightBooleanबॉर्डर के लिए true, किसी के लिए नहीं के लिए false, और कोई बदलाव नहीं के लिए null.
verticalBooleantrue का इस्तेमाल अंदरूनी वर्टिकल बॉर्डर के लिए, false का इस्तेमाल किसी भी बॉर्डर के लिए नहीं, और null का इस्तेमाल कोई बदलाव न करने के लिए किया जाता है.
horizontalBooleantrue का इस्तेमाल अंदरूनी हॉरिज़ॉन्टल बॉर्डर के लिए, false का इस्तेमाल किसी भी बॉर्डर के लिए नहीं, और null का इस्तेमाल कोई बदलाव न करने के लिए किया जाता है.
colorStringसीएसएस नोटेशन में रंग (जैसे, '#ffffff' या 'white'), डिफ़ॉल्ट रंग (काला) के लिए null.
styleBorderStyleबॉर्डर के लिए स्टाइल, डिफ़ॉल्ट स्टाइल (सॉलिड) के लिए null.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setDataValidation(rule)

यह फ़ंक्शन, रेंज में मौजूद सभी सेल के लिए डेटा की पुष्टि करने का एक नियम सेट करता है.

// Set the data validation rule for cell A1 to require a value from B1:B10.
const cell = SpreadsheetApp.getActive().getRange('A1');
const range = SpreadsheetApp.getActive().getRange('B1:B10');
const rule =
    SpreadsheetApp.newDataValidation().requireValueInRange(range).build();
cell.setDataValidation(rule);

पैरामीटर

नामटाइपब्यौरा
ruleDataValidationडेटा की पुष्टि करने का नियम सेट करने के लिए, या डेटा की पुष्टि करने की सुविधा हटाने के लिए null.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setDataValidations(rules)

यह फ़ंक्शन, रेंज में मौजूद सभी सेल के लिए डेटा की पुष्टि करने के नियम सेट करता है. इस तरीके में, डेटा की पुष्टि करने वाले दो डाइमेंशन वाले अरे का इस्तेमाल किया जाता है. इसमें इंडेक्सिंग, पहले पंक्ति के हिसाब से और फिर कॉलम के हिसाब से की जाती है. ऐरे के डाइमेंशन, रेंज के डाइमेंशन से मेल खाने चाहिए.

// Set the data validation rules for Sheet1!A1:B5 to require a value from
// Sheet2!A1:A10.
const destinationRange =
    SpreadsheetApp.getActive().getSheetByName('Sheet1').getRange('A1:B5');
const sourceRange =
    SpreadsheetApp.getActive().getSheetByName('Sheet2').getRange('A1:A10');
const rule =
    SpreadsheetApp.newDataValidation().requireValueInRange(sourceRange).build();
const rules = destinationRange.getDataValidations();
for (let i = 0; i < rules.length; i++) {
  for (let j = 0; j < rules[i].length; j++) {
    rules[i][j] = rule;
  }
}
destinationRange.setDataValidations(rules);

पैरामीटर

नामटाइपब्यौरा
rulesDataValidation[][]डेटा की पुष्टि के लिए सेट किए जाने वाले नियमों का दो डाइमेंशन वाला कलेक्शन; null वैल्यू डेटा की पुष्टि करने की सुविधा हटाती है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFontColor(color)

इससे सीएसएस नोटेशन (जैसे कि '#ffffff' या 'white') में फ़ॉन्ट का रंग सेट किया जाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B2');
cell.setFontColor('red');

पैरामीटर

नामटाइपब्यौरा
colorStringसीएसएस नोटेशन में फ़ॉन्ट का रंग (जैसे, '#ffffff' या 'white'); null वैल्यू, रंग को रीसेट करती है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFontColorObject(color)

इससे दी गई रेंज के फ़ॉन्ट का रंग सेट किया जाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const color = SpreadsheetApp.newColor()
                  .setThemeColor(SpreadsheetApp.ThemeColorType.TEXT)
                  .build();

const cell = sheet.getRange('B2');
cell.setFontColor(color);

पैरामीटर

नामटाइपब्यौरा
colorColorसेट करने के लिए फ़ॉन्ट का रंग; null वैल्यू से रंग रीसेट हो जाता है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFontColorObjects(colors)

यह फ़ॉन्ट के रंगों की आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const colorAccent1 = SpreadsheetApp.newColor()
                         .setThemeColor(SpreadsheetApp.ThemeColorType.ACCENT1)
                         .build();
const colorAccent2 = SpreadsheetApp.newColor()
                         .setThemeColor(SpreadsheetApp.ThemeColorType.ACCENT2)
                         .build();
const colorAccent3 = SpreadsheetApp.newColor()
                         .setThemeColor(SpreadsheetApp.ThemeColorType.ACCENT3)
                         .build();
const colorAccent4 = SpreadsheetApp.newColor()
                         .setThemeColor(SpreadsheetApp.ThemeColorType.ACCENT4)
                         .build();

const colors = [
  [colorAccent1, colorAccent2],
  [colorAccent3, colorAccent4],
];

const cell = sheet.getRange('B5:C6');
cell.setFontColorObjects(colors);

पैरामीटर

नामटाइपब्यौरा
colorsColor[][]यह रंगों का दो डाइमेंशन वाला कलेक्शन होता है. null वैल्यू, फ़ॉन्ट के रंग को रीसेट करती है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFontColors(colors)

यह फ़ॉन्ट के रंगों की आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए. रंग, सीएसएस नोटेशन में होते हैं. जैसे, '#ffffff' या 'white'.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const colors = [
  ['red', 'white', 'blue'],
  ['#FF0000', '#FFFFFF', '#0000FF'],  // These are the hex equivalents
];

const cell = sheet.getRange('B5:D6');
cell.setFontColors(colors);

पैरामीटर

नामटाइपब्यौरा
colorsObject[][]सीएसएस नोटेशन में रंगों का दो डाइमेंशनल ऐरे (जैसे, '#ffffff' या 'white'); null वैल्यू, रंग को रीसेट करती हैं.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFontFamilies(fontFamilies)

इससे फ़ॉन्ट फ़ैमिली की आयताकार ग्रिड सेट की जाती है. यह इस रेंज के डाइमेंशन से मेल खानी चाहिए. फ़ॉन्ट फ़ैमिली के उदाहरण "Arial" या "Helvetica" हैं.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const fonts = [
  ['Arial', 'Helvetica', 'Verdana'],
  ['Courier New', 'Arial', 'Helvetica'],
];

const cell = sheet.getRange('B2:D3');
cell.setFontFamilies(fonts);

पैरामीटर

नामटाइपब्यौरा
fontFamiliesObject[][]यह फ़ॉन्ट फ़ैमिली का दो डाइमेंशन वाला कलेक्शन होता है. null वैल्यू, फ़ॉन्ट फ़ैमिली को रीसेट करती हैं.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFontFamily(fontFamily)

इससे फ़ॉन्ट फ़ैमिली सेट की जाती है. जैसे, "Arial" या "Helvetica".

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B2');
cell.setFontFamily('Helvetica');

पैरामीटर

नामटाइपब्यौरा
fontFamilyStringसेट की जाने वाली फ़ॉन्ट फ़ैमिली; null वैल्यू, फ़ॉन्ट फ़ैमिली को रीसेट करती है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFontLine(fontLine)

यह दिए गए रेंज ('underline', 'line-through' या 'none') के फ़ॉन्ट की लाइन स्टाइल सेट करता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B2');
cell.setFontLine('line-through');

पैरामीटर

नामटाइपब्यौरा
fontLineStringफ़ॉन्ट की लाइन स्टाइल, 'underline', 'line-through' या 'none' में से कोई एक; null वैल्यू, फ़ॉन्ट की लाइन स्टाइल को रीसेट करती है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFontLines(fontLines)

लाइन स्टाइल की रेक्टैंगुलर ग्रिड सेट करता है. यह इस रेंज के डाइमेंशन से मेल खानी चाहिए.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

// The size of the two-dimensional array must match the size of the range.
const fontLines = [['underline', 'line-through', 'none']];

const range = sheet.getRange('B2:D2');
range.setFontLines(fontLines);

पैरामीटर

नामटाइपब्यौरा
fontLinesObject[][]यह फ़ॉन्ट लाइन स्टाइल ('underline', 'line-through' या 'none') का दो डाइमेंशन वाला ऐरे होता है; null वैल्यू, फ़ॉन्ट लाइन स्टाइल को रीसेट करती हैं.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFontSize(size)

इससे फ़ॉन्ट का साइज़ सेट किया जाता है. साइज़, इस्तेमाल किया जाने वाला पॉइंट साइज़ होता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B2');
cell.setFontSize(20);

पैरामीटर

नामटाइपब्यौरा
sizeIntegerपॉइंट साइज़ में फ़ॉन्ट का साइज़.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFontSizes(sizes)

इससे फ़ॉन्ट साइज़ की आयताकार ग्रिड सेट की जाती है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए. साइज़ पॉइंट में दिए गए हैं.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

// The size of the two-dimensional array must match the size of the range.
const fontSizes = [[16, 20, 24]];

const range = sheet.getRange('B2:D2');
range.setFontSizes(fontSizes);

पैरामीटर

नामटाइपब्यौरा
sizesObject[][]साइज़ का दो डाइमेंशन वाला कलेक्शन.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFontStyle(fontStyle)

दी गई रेंज ('italic' या 'normal') के लिए फ़ॉन्ट स्टाइल सेट करें.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B2');
cell.setFontStyle('italic');

पैरामीटर

नामटाइपब्यौरा
fontStyleStringफ़ॉन्ट स्टाइल, 'italic' या 'normal'; null वैल्यू, फ़ॉन्ट स्टाइल को रीसेट करती है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFontStyles(fontStyles)

इससे फ़ॉन्ट स्टाइल की आयताकार ग्रिड सेट की जाती है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

// The size of the two-dimensional array must match the size of the range.
const fontStyles = [['italic', 'normal']];

const range = sheet.getRange('B2:C2');
range.setFontStyles(fontStyles);

पैरामीटर

नामटाइपब्यौरा
fontStylesObject[][]यह फ़ॉन्ट स्टाइल का दो डाइमेंशन वाला कलेक्शन है. इसकी वैल्यू 'italic' या 'normal' होती है. null वैल्यू, फ़ॉन्ट स्टाइल को रीसेट करती हैं.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFontWeight(fontWeight)

दी गई रेंज के लिए फ़ॉन्ट वेट (सामान्य/बोल्ड) सेट करता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B2');
cell.setFontWeight('bold');

पैरामीटर

नामटाइपब्यौरा
fontWeightStringफ़ॉन्ट की मोटाई, 'bold' या 'normal'; null वैल्यू से फ़ॉन्ट की मोटाई रीसेट हो जाती है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFontWeights(fontWeights)

इससे फ़ॉन्ट वेट की रेक्टैंगुलर ग्रिड सेट की जाती है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए. फ़ॉन्ट के वज़न का उदाहरण "बोल्ड" है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

// The size of the two-dimensional array must match the size of the range.
const fontStyles = [['bold', 'bold', 'normal']];

const range = sheet.getRange('B2:D2');
range.setFontWeights(fontStyles);

पैरामीटर

नामटाइपब्यौरा
fontWeightsObject[][]फ़ॉन्ट की मोटाई का दो डाइमेंशन वाला ऐरे, 'bold' या 'normal'; null वैल्यू, फ़ॉन्ट की मोटाई को रीसेट करती हैं.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFormula(formula)

इस रेंज के लिए फ़ॉर्मूला अपडेट करता है. दिया गया फ़ॉर्मूला, A1 नोटेशन में होना चाहिए.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B5');
cell.setFormula('=SUM(B3:B4)');

पैरामीटर

नामटाइपब्यौरा
formulaStringयह स्ट्रिंग, सेल के लिए सेट किए जाने वाले फ़ॉर्मूले को दिखाती है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFormulaR1C1(formula)

इस रेंज के लिए फ़ॉर्मूला अपडेट करता है. दिया गया फ़ॉर्मूला, R1C1 नोटेशन में होना चाहिए.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B5');
// This sets the formula to be the sum of the 3 rows above B5
cell.setFormulaR1C1('=SUM(R[-3]C[0]:R[-1]C[0])');

पैरामीटर

नामटाइपब्यौरा
formulaStringस्ट्रिंग फ़ॉर्मूला.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFormulas(formulas)

फ़ॉर्मूलों की आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए. दिए गए फ़ॉर्मूले, A1 नोटेशन में होने चाहिए. इस तरीके में, फ़ॉर्मूलों का दो डाइमेंशन वाला ऐरे लिया जाता है. इसे पहले पंक्ति और फिर कॉलम के हिसाब से इंडेक्स किया जाता है. ऐरे के डाइमेंशन, रेंज के डाइमेंशन से मेल खाने चाहिए.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

// This sets the formulas to be a row of sums, followed by a row of averages
// right below. The size of the two-dimensional array must match the size of the
// range.
const formulas = [
  ['=SUM(B2:B4)', '=SUM(C2:C4)', '=SUM(D2:D4)'],
  ['=AVERAGE(B2:B4)', '=AVERAGE(C2:C4)', '=AVERAGE(D2:D4)'],
];

const cell = sheet.getRange('B5:D6');
cell.setFormulas(formulas);

पैरामीटर

नामटाइपब्यौरा
formulasString[][]यह फ़ॉर्मूलों की दो डाइमेंशन वाली स्ट्रिंग ऐरे होती है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFormulasR1C1(formulas)

फ़ॉर्मूलों की आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए. दिए गए फ़ॉर्मूले, R1C1 नोटेशन में होने चाहिए.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

// This creates formulas for a row of sums, followed by a row of averages.
const sumOfRowsAbove = '=SUM(R[-3]C[0]:R[-1]C[0])';
const averageOfRowsAbove = '=AVERAGE(R[-4]C[0]:R[-2]C[0])';

// The size of the two-dimensional array must match the size of the range.
const formulas = [
  [sumOfRowsAbove, sumOfRowsAbove, sumOfRowsAbove],
  [averageOfRowsAbove, averageOfRowsAbove, averageOfRowsAbove],
];

const cell = sheet.getRange('B5:D6');
// This sets the formula to be the sum of the 3 rows above B5.
cell.setFormulasR1C1(formulas);

पैरामीटर

नामटाइपब्यौरा
formulasString[][]R1C1 फ़ॉर्मैट में फ़ॉर्मूलों की दो डाइमेंशन वाली ऐरे.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setHorizontalAlignment(alignment)

दी गई रेंज के लिए, हॉरिज़ॉन्टल (बाएं से दाएं) अलाइनमेंट (बाएं/बीच/दाएं) सेट करता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B2');
cell.setHorizontalAlignment('center');

पैरामीटर

नामटाइपब्यौरा
alignmentStringअलाइनमेंट, 'left', 'center' या 'normal' में से कोई एक; null वैल्यू से अलाइनमेंट रीसेट हो जाता है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setHorizontalAlignments(alignments)

यह हॉरिज़ॉन्टल अलाइनमेंट की रेक्टैंगुलर ग्रिड सेट करता है. setHorizontalAlignment(alignment) देखें

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

// The size of the two-dimensional array must match the size of the range.
const horizontalAlignments = [['left', 'right', 'center']];

const range = sheet.getRange('B2:D2');
range.setHorizontalAlignments(horizontalAlignments);

पैरामीटर

नामटाइपब्यौरा
alignmentsObject[][]यह अलाइनमेंट की दो डाइमेंशन वाली एक ऐसी ऐरे होती है जिसमें 'left', 'center' या 'normal' में से कोई एक वैल्यू होती है. null वैल्यू, अलाइनमेंट को रीसेट करती है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

इन्हें भी देखें


setNote(note)

नोट को दी गई वैल्यू पर सेट करता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B2');
cell.setNote('This is a note');

पैरामीटर

नामटाइपब्यौरा
noteStringरेंज के लिए सेट की जाने वाली नोट वैल्यू; null वैल्यू से नोट हट जाता है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setNotes(notes)

नोट की आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खानी चाहिए.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

// The size of the two-dimensional array must match the size of the range.
const notes = [
  ['it goes', 'like this', 'the fourth, the fifth'],
  ['the minor fall', 'and the', 'major lift'],
];

const cell = sheet.getRange('B2:D3');
cell.setNotes(notes);

पैरामीटर

नामटाइपब्यौरा
notesObject[][]नोट का दो डाइमेंशन वाला कलेक्शन; null वैल्यू, नोट को हटा देती हैं.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

इन्हें भी देखें


setNumberFormat(numberFormat)

यह फ़ंक्शन, फ़ॉर्मैटिंग स्ट्रिंग के हिसाब से नंबर या तारीख का फ़ॉर्मैट सेट करता है. स्वीकार किए गए फ़ॉर्मैट पैटर्न के बारे में Sheets API के दस्तावेज़ में बताया गया है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B2');
// Always show 3 decimal points
cell.setNumberFormat('0.000');

पैरामीटर

नामटाइपब्यौरा
numberFormatStringयह एक नंबर फ़ॉर्मैट स्ट्रिंग होती है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setNumberFormats(numberFormats)

यह फ़ंक्शन, संख्याओं या तारीखों के फ़ॉर्मैट की आयताकार ग्रिड सेट करता है. यह ज़रूरी है कि यह ग्रिड, इस रेंज के डाइमेंशन से मेल खाती हो. ये वैल्यू, फ़ॉर्मैट पैटर्न वाली स्ट्रिंग होती हैं. इनके बारे में Sheets API के दस्तावेज़ में बताया गया है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

// The size of the two-dimensional array must match the size of the range.
const formats = [['0.000', '0,000,000', '$0.00']];

const range = sheet.getRange('B2:D2');
range.setNumberFormats(formats);

पैरामीटर

नामटाइपब्यौरा
numberFormatsObject[][]यह संख्या के फ़ॉर्मैट का दो डाइमेंशन वाला कलेक्शन होता है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setRichTextValue(value)

इस फ़ंक्शन का इस्तेमाल करके, रेंज में मौजूद सेल के लिए रिच टेक्स्ट वैल्यू सेट की जाती है.

// Sets all cells in range B2:D4 to have the text "Hello world", with "Hello"
// bolded.
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange('B2:D4');
const bold = SpreadsheetApp.newTextStyle().setBold(true).build();
const richText = SpreadsheetApp.newRichTextValue()
                     .setText('Hello world')
                     .setTextStyle(0, 5, bold)
                     .build();
range.setRichTextValue(richText);

पैरामीटर

नामटाइपब्यौरा
valueRichTextValueरिच टेक्स्ट की मनचाही वैल्यू.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setRichTextValues(values)

इससे रिच टेक्स्ट वैल्यू की आयताकार ग्रिड सेट की जाती है.

// Sets the cells in range A1:A2 to have Rich Text values.
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange('A1:A2');
const bold = SpreadsheetApp.newTextStyle().setBold(true).build();
const italic = SpreadsheetApp.newTextStyle().setItalic(true).build();
const richTextA1 = SpreadsheetApp.newRichTextValue()
                       .setText('This cell is bold')
                       .setTextStyle(bold)
                       .build();
const richTextA2 = SpreadsheetApp.newRichTextValue()
                       .setText('bold words, italic words')
                       .setTextStyle(0, 11, bold)
                       .setTextStyle(12, 24, italic)
                       .build();
range.setRichTextValues([[richTextA1], [richTextA2]]);

पैरामीटर

नामटाइपब्यौरा
valuesRichTextValue[][]रिच टेक्स्ट की मनमुताबिक वैल्यू.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

इससे यह सेट होता है कि रेंज में हाइपरलिंक दिखने चाहिए या नहीं.

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can useSpreadsheetApp.getActiveSpreadsheet()
// instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets cell A30 and sets its hyperlink value.
const range = sheet.getRange('A30');
range.setValue('https://www.example.com');

// Sets cell A30 to show hyperlinks.
range.setShowHyperlink(true);

पैरामीटर

नामटाइपब्यौरा
showHyperlinkBooleanहाइपरलिंक दिखाना है या नहीं.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setTextDirection(direction)

इस विकल्प से, रेंज में मौजूद सेल के लिए टेक्स्ट की दिशा सेट की जाती है. अगर तय की गई दिशा null है, तो दिशा का अनुमान लगाया जाता है और फिर उसे सेट किया जाता है.

// Sets right-to-left text direction for the range.
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange('B5:C6');
range.setTextDirection(SpreadsheetApp.TextDirection.RIGHT_TO_LEFT);

पैरामीटर

नामटाइपब्यौरा
directionTextDirectionटेक्स्ट की दिशा; अगर null दिशा को सेट करने से पहले ही इसका अनुमान लगा लिया जाता है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setTextDirections(directions)

इससे टेक्स्ट की दिशाओं का आयताकार ग्रिड सेट किया जाता है. अगर तय की गई दिशा null है, तो दिशा का अनुमान लगाया जाता है और फिर उसे सेट किया जाता है.

// Copies all of the text directions from range A1:B2 over to range C5:D6.
const sheet = SpreadsheetApp.getActiveSheet();
const range1 = sheet.getRange('A1:B2');
const range2 = sheet.getRange('C5:D6');

range2.setTextRotations(range1.getTextDirections());

पैरामीटर

नामटाइपब्यौरा
directionsTextDirection[][]टेक्स्ट के लिए निर्देश; अगर कोई निर्देश null है, तो उसे सेट करने से पहले अनुमान लगाया जाता है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setTextRotation(degrees)

इस विकल्प से, रेंज में मौजूद सेल के लिए टेक्स्ट रोटेशन की सेटिंग सेट की जाती हैं. इनपुट, स्टैंडर्ड टेक्स्ट ओरिएंटेशन और मनचाहे ओरिएंटेशन के बीच के कोण के हिसाब से होता है. शून्य का इनपुट यह दिखाता है कि टेक्स्ट को स्टैंडर्ड ओरिएंटेशन पर सेट किया गया है.

बाएं से दाएं की ओर लिखे जाने वाले टेक्स्ट के लिए, पॉज़िटिव ऐंगल घड़ी की उलटी दिशा में होते हैं. वहीं, दाएं से बाएं की ओर लिखे जाने वाले टेक्स्ट के लिए, ये घड़ी की दिशा में होते हैं.

// Sets all cell's in range B2:D4 to have text rotated up 45 degrees.
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange('B2:D4');

range.setTextRotation(45);

पैरामीटर

नामटाइपब्यौरा
degreesIntegerस्टैंडर्ड ओरिएंटेशन और मनचाहे ओरिएंटेशन के बीच का ऐंगल. बाएं से दाएं लिखे जाने वाले टेक्स्ट के लिए, पॉज़िटिव ऐंगल घड़ी की उलटी दिशा में होते हैं.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setTextRotation(rotation)

इस विकल्प से, रेंज में मौजूद सेल के लिए टेक्स्ट रोटेशन की सेटिंग सेट की जाती हैं.

// Sets all cell's in range B2:D4 to have the same text rotation settings as
// cell A1.
const sheet = SpreadsheetApp.getActiveSheet();

const rotation = sheet.getRange('A1').getTextRotation();

sheet.getRange('B2:D4').setTextRotation(rotation);

पैरामीटर

नामटाइपब्यौरा
rotationTextRotationटेक्स्ट को घुमाने की सेटिंग.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setTextRotations(rotations)

इससे टेक्स्ट रोटेशन की आयताकार ग्रिड सेट की जाती है.

// Copies all of the text rotations from range A1:B2 over to range C5:D6.
const sheet = SpreadsheetApp.getActiveSheet();
const range1 = sheet.getRange('A1:B2');
const range2 = sheet.getRange('C5:D6');

range2.setTextRotations(range1.getTextRotations());

पैरामीटर

नामटाइपब्यौरा
rotationsTextRotation[][]टेक्स्ट को घुमाने की सेटिंग.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setTextStyle(style)

इस विकल्प से, रेंज में मौजूद सेल के लिए टेक्स्ट स्टाइल सेट की जाती है.

// Sets the cells in range C5:D6 to have underlined size 15 font.
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange('C5:D6');
const style =
    SpreadsheetApp.newTextStyle().setFontSize(15).setUnderline(true).build();
range.setTextStyle(style);

पैरामीटर

नामटाइपब्यौरा
styleTextStyleटेक्स्ट की मनचाही स्टाइल.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setTextStyles(styles)

इससे टेक्स्ट स्टाइल का आयताकार ग्रिड सेट किया जाता है.

// Sets text styles for cells in range A1:B2
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange('A1:B2');
const bold = SpreadsheetApp.newTextStyle().setBold(true).build();
const otherStyle = SpreadsheetApp.newTextStyle()
                       .setBold(true)
                       .setUnderline(true)
                       .setItalic(true)
                       .setForegroundColor('#335522')
                       .setFontSize(44)
                       .build();
range.setTextStyles([
  [bold, otherStyle],
  [otherStyle, bold],
]);

पैरामीटर

नामटाइपब्यौरा
stylesTextStyle[][]टेक्स्ट के लिए अपनी पसंद के स्टाइल.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setValue(value)

इस विकल्प का इस्तेमाल करके, रेंज की वैल्यू सेट की जाती है. वैल्यू, संख्या, स्ट्रिंग, बूलियन या तारीख हो सकती है. अगर यह '=' से शुरू होता है, तो इसे फ़ॉर्मूला माना जाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B2');
cell.setValue(100);

पैरामीटर

नामटाइपब्यौरा
valueObjectरेंज की वैल्यू.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setValues(values)

वैल्यू की आयताकार ग्रिड सेट करता है. यह इस रेंज के डाइमेंशन से मेल खानी चाहिए. अगर कोई वैल्यू = से शुरू होती है, तो उसे फ़ॉर्मूला माना जाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

// The size of the two-dimensional array must match the size of the range.
const values = [['2.000', '1,000,000', '$2.99']];

const range = sheet.getRange('B2:D2');
range.setValues(values);

पैरामीटर

नामटाइपब्यौरा
valuesObject[][]वैल्यू का दो डाइमेंशन वाला अरे.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setVerticalAlignment(alignment)

दी गई रेंज के लिए, वर्टिकल (ऊपर से नीचे) अलाइनमेंट सेट करें (ऊपर/बीच में/नीचे).

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B2');
cell.setVerticalAlignment('middle');

पैरामीटर

नामटाइपब्यौरा
alignmentStringअलाइनमेंट, 'top', 'middle' या 'bottom' में से कोई एक; null वैल्यू से अलाइनमेंट रीसेट हो जाता है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setVerticalAlignments(alignments)

वर्टिकल अलाइनमेंट की आयताकार ग्रिड सेट करता है. यह इस रेंज के डाइमेंशन से मेल खानी चाहिए.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

// The size of the two-dimensional array must match the size of the range.
const alignments = [['top', 'middle', 'bottom']];

const range = sheet.getRange('B2:D2');
range.setVerticalAlignments(alignments);

पैरामीटर

नामटाइपब्यौरा
alignmentsObject[][]यह अलाइनमेंट की दो डाइमेंशन वाली एक सरणी है. इसमें 'top', 'middle' या 'bottom' में से कोई एक वैल्यू होती है. null वैल्यू, अलाइनमेंट को रीसेट करती है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

इन्हें भी देखें


setVerticalText(isVertical)

इस विकल्प से यह सेट किया जाता है कि रेंज में मौजूद सेल के टेक्स्ट को स्टैक करना है या नहीं. अगर टेक्स्ट को वर्टिकल तरीके से स्टैक किया जाता है, तो टेक्स्ट को घुमाने की सेटिंग को अनदेखा कर दिया जाता है.

// Sets all cell's in range B2:D4 to have vertically stacked text.
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange('B2:D4');

range.setVerticalText(true);

पैरामीटर

नामटाइपब्यौरा
isVerticalBooleanटेक्स्ट को स्टैक करना है या नहीं.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setWrap(isWrapEnabled)

इस फ़ंक्शन का इस्तेमाल करके, दी गई रेंज के सेल रैप को सेट किया जाता है.

टेक्स्ट रैप की सुविधा चालू होने पर (डिफ़ॉल्ट रूप से यह सुविधा चालू होती है), सेल का साइज़ बदलकर उसमें मौजूद पूरा कॉन्टेंट दिखाया जाता है. रैप किए जाने की सुविधा बंद होने पर, सेल में मौजूद कॉन्टेंट को सेल में ज़्यादा से ज़्यादा दिखाया जाता है. इसके लिए, सेल का साइज़ नहीं बदला जाता और कॉन्टेंट को कई लाइनों में नहीं दिखाया जाता.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

const cell = sheet.getRange('B2');
cell.setWrap(true);

पैरामीटर

नामटाइपब्यौरा
isWrapEnabledBooleanटेक्स्ट रैप करना है या नहीं.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setWrapStrategies(strategies)

यह रैप करने की रणनीतियों की रेक्टैंगुलर ग्रिड सेट करता है.

// Copies all of the wrap strategies from range A1:B2 over to range C5:D6.
const sheet = SpreadsheetApp.getActiveSheet();
const range1 = sheet.getRange('A1:B2');
const range2 = sheet.getRange('C5:D6');

range2.setWrapStrategies(range1.getWrapStrategies());

पैरामीटर

नामटाइपब्यौरा
strategiesWrapStrategy[][]रैपिंग के लिए इस्तेमाल की जाने वाली रणनीतियां.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setWrapStrategy(strategy)

इस विकल्प से, रेंज में मौजूद सेल के लिए टेक्स्ट रैपिंग की रणनीति सेट की जाती है.

// Sets all cells in range B2:D4 to use the clip wrap strategy.
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange('B2:D4');

range.setWrapStrategy(SpreadsheetApp.WrapStrategy.CLIP);

पैरामीटर

नामटाइपब्यौरा
strategyWrapStrategyरैपिंग का पसंदीदा तरीका.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setWraps(isWrapEnabled)

इससे टेक्स्ट रैप करने की नीतियों की रेक्टैंगल ग्रिड सेट की जाती है. यह इस रेंज के डाइमेंशन से मेल खानी चाहिए. जिन सेल में रैप करने की सुविधा चालू होती है (डिफ़ॉल्ट रूप से चालू होती है), उनका साइज़ बदलकर पूरा कॉन्टेंट दिखाया जाता है. टेक्स्ट रैप की सुविधा बंद होने पर, सेल में ज़्यादा से ज़्यादा टेक्स्ट दिखता है. इसके लिए, सेल का साइज़ नहीं बदला जाता और न ही टेक्स्ट को कई लाइनों में दिखाया जाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];

// The size of the two-dimensional array must match the size of the range.
const wraps = [[true, true, false]];

const range = sheet.getRange('B2:D2');
range.setWraps(wraps);

पैरामीटर

नामटाइपब्यौरा
isWrapEnabledObject[][]यह रैप वैरिएबल का दो डाइमेंशन वाला अरे होता है. इससे यह तय होता है कि किसी सेल में टेक्स्ट को रैप करना है या नहीं.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

इन्हें भी देखें


shiftColumnGroupDepth(delta)

यह फ़ंक्शन, तय की गई रकम के हिसाब से रेंज के कॉलम ग्रुपिंग की डेप्थ को बदलता है.

इससे रेंज में आने वाले ग्रुप बनाए, बदले या मिटाए जा सकते हैं. पॉज़िटिव डेल्टा के लिए, ग्रुप बनाए जाते हैं और/या उनमें बदलाव किया जाता है. नेगेटिव डेल्टा के लिए, ग्रुप मिटाए जाते हैं और/या उनमें बदलाव किया जाता है.

ग्रुप डेप्थ को शून्य से कम या आठ से ज़्यादा करने पर, इसका कोई असर नहीं पड़ता.

अगर column group control position BEFORE है, तो पहली लाइन की गहराई को बदलने की कोशिश करते समय गड़बड़ी होती है.

const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
const range = sheet.getActiveRange();

// The column grouping depth is increased by 1.
range.shiftColumnGroupDepth(1);

// The column grouping depth is decreased by 1.
range.shiftColumnGroupDepth(-1);

पैरामीटर

नामटाइपब्यौरा
deltaIntegerइस रेंज के कॉलम ग्रुप की डेप्थ में बदलाव करने के लिए वैल्यू.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

थ्रो

Error — जब कंट्रोल की पोज़िशन GroupControlTogglePosition.BEFORE हो, तब पहले कॉलम की डेप्थ को बदलने की कोशिश करने पर

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

shiftRowGroupDepth(delta)

यह फ़ंक्शन, तय की गई रकम के हिसाब से रेंज की लाइन ग्रुपिंग की डेप्थ बदलता है.

इससे रेंज में आने वाले ग्रुप बनाए, बदले या मिटाए जा सकते हैं. पॉज़िटिव डेल्टा के लिए, ग्रुप बनाए जाते हैं और/या उनमें बदलाव किया जाता है. नेगेटिव डेल्टा के लिए, ग्रुप मिटाए जाते हैं और/या उनमें बदलाव किया जाता है.

ग्रुप डेप्थ को शून्य से कम या आठ से ज़्यादा करने पर, इसका कोई असर नहीं पड़ता.

अगर row group control position BEFORE है, तो पहली लाइन की गहराई को बदलने की कोशिश करते समय गड़बड़ी होती है.

const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
const range = sheet.getActiveRange();

// The row grouping depth is increased by 1.
range.shiftRowGroupDepth(1);

// The row grouping depth is decreased by 1.
range.shiftRowGroupDepth(-1);

पैरामीटर

नामटाइपब्यौरा
deltaIntegerइस रेंज के लिए, लाइन ग्रुप की डेप्थ में बदलाव करने की वैल्यू.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

थ्रो

Error — जब कंट्रोल की पोज़िशन GroupControlTogglePosition.BEFORE हो, तब पहली लाइन की डेप्थ को बदलने की कोशिश करने पर

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

sort(sortSpecObj)

यह फ़ंक्शन, दी गई रेंज में मौजूद सेल को तय किए गए कॉलम और क्रम के हिसाब से क्रम से लगाता है.

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('A1:C7');

// Sorts by the values in the first column (A)
range.sort(1);

// Sorts by the values in the second column (B)
range.sort(2);

// Sorts descending by column B
range.sort({column: 2, ascending: false});

// Sorts descending by column B, then ascending by column A
// Note the use of an array
range.sort([
  {column: 2, ascending: false},
  {column: 1, ascending: true},
]);

// For rows that are sorted in ascending order, the "ascending" parameter is
// optional, and just an integer with the column can be used instead. Note that
// in general, keeping the sort specification consistent results in more
// readable code. You can express the earlier sort as:
range.sort([{column: 2, ascending: false}, 1]);

// Alternatively, if you want all columns to be in ascending order, you can use
// the following (this makes column 2 ascending)
range.sort([2, 1]);
// ... which is equivalent to
range.sort([
  {column: 2, ascending: true},
  {column: 1, ascending: true},
]);

पैरामीटर

नामटाइपब्यौरा
sortSpecObjObjectवे कॉलम जिनके हिसाब से क्रम से लगाना है.

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

splitTextToColumns()

यह फ़ंक्शन, टेक्स्ट वाले कॉलम को कई कॉलम में बांटता है. इसके लिए, यह अपने-आप पता लगाए गए डेलिमिटर का इस्तेमाल करता है.

// A1:A3 has the following values:
//           A                  B                 C
// 1 |one,one,one      |                 |                 |
// 2 |two,two,two      |                 |                 |
// 3 |three,three,three|                 |                 |

const range = SpreadsheetApp.getActiveSheet().getRange('A1:A3');
range.splitTextToColumns();

// Result after splitting the text to columns:
//           A                  B                 C
// 1 |one              |one              |one              |
// 2 |two              |two              |two              |
// 3 |three            |three            |three            |

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

splitTextToColumns(delimiter)

इस फ़ंक्शन की मदद से, टेक्स्ट के किसी कॉलम को कई कॉलम में बांटा जा सकता है. इसके लिए, कस्टम डेलिमिटर के तौर पर तय की गई स्ट्रिंग का इस्तेमाल किया जाता है.

// A1:A3 has the following values:
//           A                  B                 C
// 1 |one#one#one      |                 |                 |
// 2 |two#two#two      |                 |                 |
// 3 |three#three#three|                 |                 |

const range = SpreadsheetApp.getActiveSheet().getRange('A1:A3');
range.splitTextToColumns('#');

// Result after splitting the text to columns:
//           A                  B                 C
// 1 |one              |one              |one              |
// 2 |two              |two              |two              |
// 3 |three            |three            |three            |

पैरामीटर

नामटाइपब्यौरा
delimiterStringवह कस्टम डेलिमीटर जिसके आधार पर टेक्स्ट को अलग-अलग हिस्सों में बांटा जाता है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

splitTextToColumns(delimiter)

यह फ़ंक्शन, टेक्स्ट वाले कॉलम को तय किए गए डेलिमिटर के आधार पर कई कॉलम में बांटता है.

// A1:A3 has the following values:
//           A                  B                 C
// 1 |one;one;one      |                 |                 |
// 2 |two;two;two      |                 |                 |
// 3 |three;three;three|                 |                 |

const range = SpreadsheetApp.getActiveSheet().getRange('A1:A3');
range.splitTextToColumns(SpreadsheetApp.TextToColumnsDelimiter.SEMICOLON);

// Result after splitting the text to columns:
//           A                  B                 C
// 1 |one              |one              |one              |
// 2 |two              |two              |two              |
// 3 |three            |three            |three            |

पैरामीटर

नामटाइपब्यौरा
delimiterTextToColumnsDelimiterस्ट्रिंग को बांटने के लिए, प्रीसेट डेलिमिटर.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

trimWhitespace()

यह फ़ंक्शन, इस रेंज की हर सेल में मौजूद खाली जगह (जैसे कि स्पेस, टैब या नई लाइनें) को हटाता है. यह फ़ंक्शन, हर सेल के टेक्स्ट की शुरुआत और आखिर में मौजूद सभी खाली सफ़ेद जगहों को हटा देता है. साथ ही, बची हुई खाली सफ़ेद जगहों के किसी भी सबसीक्वेंस को एक स्पेस में बदल देता है.

const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
const range = sheet.getRange('A1:A4');
range.activate();
range.setValues([
  ' preceding space',
  'following space ',
  'two  middle  spaces',
  '   =SUM(1,2)',
]);

range.trimWhitespace();

const values = range.getValues();
// Values are ['preceding space', 'following space', 'two middle spaces',
// '=SUM(1,2)']

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

uncheck()

यह फ़ंक्शन, रेंज में मौजूद चेकबॉक्स की स्थिति को “unchecked” में बदल देता है. यह रेंज में मौजूद उन सेल को अनदेखा करता है जिनमें फ़िलहाल, कॉन्फ़िगर की गई checked या unchecked वैल्यू मौजूद नहीं है.

// Changes the state of cells which currently contain either the checked or
// unchecked value configured in the range A1:B10 to 'unchecked'.
const range = SpreadsheetApp.getActive().getRange('A1:B10');
range.uncheck();

वापसी का टिकट

Range — यह रेंज, चेनिंग के लिए है.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

ऐसे तरीके जो अब इस्तेमाल में नहीं हैं