स्प्रेडशीट की रेंज ऐक्सेस करना और उनमें बदलाव करना. रेंज, शीट में एक सेल या आस-पास की सेल का ग्रुप हो सकती है.
तरीके
तरीका | रिटर्न टाइप | संक्षिप्त विवरण |
---|---|---|
activate() | Range | यह फ़ंक्शन, तय की गई रेंज को active range के तौर पर सेट करता है. साथ ही, रेंज में सबसे ऊपर बाईं ओर मौजूद सेल को current cell के तौर पर सेट करता है. |
activate | Range | किसी सेल को current cell के तौर पर सेट करता है. |
add | Range | रेंज में, तय की गई कुंजी के साथ डेवलपर मेटाडेटा जोड़ता है. |
add | Range | तय की गई कुंजी और रेंज में दिखने की सेटिंग के साथ डेवलपर मेटाडेटा जोड़ता है. |
add | Range | यह फ़ंक्शन, रेंज में बताई गई कुंजी और वैल्यू के साथ डेवलपर मेटाडेटा जोड़ता है. |
add | Range | तय की गई कीवर्ड, वैल्यू, और विज़िबिलिटी के साथ डेवलपर मेटाडेटा को रेंज में जोड़ता है. |
apply | Banding | रेंज में कॉलम बैंडिंग की डिफ़ॉल्ट थीम लागू करता है. |
apply | Banding | रेंज में, कॉलम के लिए तय की गई थीम लागू करता है. |
apply | Banding | यह फ़ंक्शन, हेडर और फ़ुटर की तय सेटिंग के साथ रेंज पर, कॉलम बैंडिंग की किसी खास थीम को लागू करता है. |
apply | Banding | रेंज में, लाइन को बांटने की डिफ़ॉल्ट थीम लागू करता है. |
apply | Banding | रेंज में, पंक्ति के बैंड की कोई खास थीम लागू करता है. |
apply | Banding | हेडर और फ़ुटर की तय सेटिंग के साथ, रेंज में पंक्ति बैंडिंग की चुनी गई थीम लागू करता है. |
auto | void | इस रेंज में मौजूद डेटा के आधार पर, destination को डेटा से भरता है. |
auto | void | यह फ़ंक्शन, आस-पास की सेल के आधार पर, नई वैल्यू से भरने के लिए रेंज का हिसाब लगाता है. साथ ही, उस रेंज में मौजूद डेटा के आधार पर, उस रेंज को नई वैल्यू से अपने-आप भर देता है. |
break | Range | रेंज में मौजूद, एक से ज़्यादा कॉलम वाली सेल को फिर से अलग-अलग सेल में बांटें. |
can | Boolean | इससे यह तय होता है कि उपयोगकर्ता के पास रेंज में मौजूद हर सेल में बदलाव करने की अनुमति है या नहीं. |
check() | Range | रेंज में मौजूद चेकबॉक्स की स्थिति को “चेक किया गया” में बदलता है. |
clear() | Range | कॉन्टेंट और फ़ॉर्मैट की रेंज हटाता है. |
clear(options) | Range | दिए गए बेहतर विकल्पों के मुताबिक, कॉन्टेंट, फ़ॉर्मैट, डेटा की पुष्टि करने के नियमों, और/या टिप्पणियों की रेंज को मिटाता है. |
clear | Range | रेंज का कॉन्टेंट मिटा देता है, लेकिन फ़ॉर्मैटिंग में कोई बदलाव नहीं करता. |
clear | Range | रेंज के लिए, डेटा की पुष्टि करने के नियमों को हटाता है. |
clear | Range | इस रेंज की फ़ॉर्मैटिंग हटाता है. |
clear | Range | यह फ़ंक्शन, दी गई सेल या सेल में मौजूद नोट मिटा देता है. |
collapse | Range | इस रेंज में मौजूद सभी ग्रुप को छोटा कर देता है. |
copy | void | रेंज की फ़ॉर्मैटिंग को बताई गई जगह पर कॉपी करें. |
copy | void | रेंज की फ़ॉर्मैटिंग को बताई गई जगह पर कॉपी करें. |
copy | void | यह फ़ंक्शन, सेल की किसी रेंज से डेटा को दूसरी रेंज में कॉपी करता है. |
copy | void | यह फ़ंक्शन, सेल की किसी रेंज से डेटा को दूसरी रेंज में कॉपी करता है. |
copy | void | यह फ़ंक्शन, सेल की किसी रेंज से डेटा को दूसरी रेंज में कॉपी करता है. |
copy | void | रेंज के कॉन्टेंट को दी गई जगह पर कॉपी करें. |
copy | void | रेंज के कॉन्टेंट को दी गई जगह पर कॉपी करें. |
create | Data | डेटा सोर्स से खाली डेटा सोर्स पिवट टेबल बनाता है. यह टेबल, इस रेंज की पहली सेल पर ऐंकर की जाती है. |
create | Data | डेटा सोर्स से खाली डेटा सोर्स टेबल बनाता है. यह टेबल, इस रेंज की पहली सेल में ऐंकर की जाती है. |
create | Developer | इस रेंज के दायरे में डेवलपर मेटाडेटा ढूंढने के लिए, DeveloperMetadataFinderApi दिखाता है. |
create | Filter | यह फ़ंक्शन एक फ़िल्टर बनाता है और उसे शीट की तय की गई रेंज पर लागू करता है. |
create | Pivot | इस रेंज में पहली सेल पर ऐंकर की गई source से, खाली पिवट टेबल बनाता है. |
create | Text | रेंज के लिए टेक्स्ट फ़ाइंडर बनाता है, जो इस रेंज में टेक्स्ट ढूंढ सकता है और उसे बदल सकता है. |
delete | void | सेल की इस रेंज को मिटाता है. |
expand | Range | छोटा किए गए उन ग्रुप को बड़ा करता है जिनकी रेंज या कंट्रोल टॉगल, इस रेंज से इंटरसेक्शन करता है. |
getA1Notation() | String | A1 नोटेशन में, रेंज की स्ट्रिंग के बारे में जानकारी देता है. |
get | String | रेंज में सबसे ऊपर बाईं ओर मौजूद सेल का बैकग्राउंड रंग दिखाता है. उदाहरण के लिए, '#ffffff' . |
get | Color | रेंज में सबसे ऊपर बाईं ओर मौजूद सेल का बैकग्राउंड रंग दिखाता है. |
get | Color[][] | यह फ़ंक्शन, रेंज में मौजूद सेल के बैकग्राउंड के रंग दिखाता है. |
get | String[][] | रेंज में मौजूद सेल के बैकग्राउंड के रंग दिखाता है. उदाहरण के लिए, '#ffffff' . |
get | Banding[] | इस रेंज में मौजूद किसी भी सेल पर लागू सभी बैंडिंग दिखाता है. |
get | Range | किसी रेंज में दी गई सेल दिखाता है. |
get | Integer | इस रेंज के लिए, कॉलम की शुरुआती स्थिति दिखाता है. |
get | Range | यह फ़ंक्शन, चार मुख्य Direction में बड़ी की गई रेंज की कॉपी दिखाता है. इससे, आस-पास मौजूद उन सभी सेल को कवर किया जा सकता है जिनमें डेटा है. |
get | Range | अगर डाइमेंशन Dimension.ROWS है, तो Direction.UP और Direction.DOWN तक बड़ी की गई रेंज की कॉपी दिखाता है. अगर डाइमेंशन Dimension.COLUMNS है, तो Direction.NEXT और Direction.PREVIOUS तक बड़ी की गई रेंज की कॉपी दिखाता है. |
get | Data | रेंज में पहली सेल के लिए Data दिखाता है. अगर सेल में डेटा सोर्स का फ़ॉर्मूला नहीं है, तो null दिखाता है. |
get | Data | रेंज में मौजूद सेल के लिए Data दिखाता है. |
get | Data | इस फ़ंक्शन से, रेंज से इंटरसेक्शन वाली सभी डेटा सोर्स पिवट टेबल मिलती हैं. |
get | Data | रेंज से इंटरसेक्शन वाली सभी डेटा सोर्स टेबल दिखाता है. |
get | String | इस रेंज में मौजूद डेटा का यूआरएल दिखाता है. इसका इस्तेमाल चार्ट और क्वेरी बनाने के लिए किया जा सकता है. |
get | Data | इस ऑब्जेक्ट में मौजूद डेटा को DataTable के तौर पर दिखाता है. |
get | Data | इस रेंज में मौजूद डेटा को डेटाटेबल के तौर पर दिखाता है. |
get | Data | यह फ़ंक्शन, रेंज में सबसे ऊपर बाईं ओर मौजूद सेल के लिए, डेटा की पुष्टि करने का नियम दिखाता है. |
get | Data | यह फ़ंक्शन, रेंज में मौजूद सभी सेल के लिए डेटा की पुष्टि करने के नियम दिखाता है. |
get | Developer | इस रेंज से जुड़ा डेवलपर मेटाडेटा पाता है. |
get | String | रेंज में सबसे ऊपर बाईं ओर मौजूद सेल की दिखाई गई वैल्यू दिखाता है. |
get | String[][] | इस रेंज के लिए, वैल्यू का रेक्टैंगल ग्रिड दिखाता है. |
get | Filter | यह उस शीट पर मौजूद फ़िल्टर दिखाता है जिससे यह रेंज जुड़ी है. अगर शीट पर कोई फ़िल्टर नहीं है, तो यह null दिखाता है. |
get | Color | रेंज के सबसे ऊपर बाएं कोने में मौजूद सेल के फ़ॉन्ट का रंग दिखाता है. |
get | Color[][] | रेंज में मौजूद सेल के फ़ॉन्ट के रंग दिखाता है. |
get | String[][] | यह फ़ंक्शन, रेंज में मौजूद सेल की फ़ॉन्ट फ़ैमिली दिखाता है. |
get | String | रेंज के सबसे ऊपर बाएं कोने में मौजूद सेल की फ़ॉन्ट फ़ैमिली दिखाता है. |
get | String | रेंज के सबसे ऊपर बाएं कोने में मौजूद सेल की लाइन स्टाइल ('underline' ,
'line-through' या 'none' ) दिखाता है. |
get | String[][] | रेंज ('underline' , 'line-through' या
'none' ) में मौजूद सेल की लाइन स्टाइल दिखाता है. |
get | Integer | रेंज के सबसे ऊपर बाएं कोने में मौजूद सेल के फ़ॉन्ट साइज़ को पॉइंट साइज़ में दिखाता है. |
get | Integer[][] | यह फ़ंक्शन, रेंज में मौजूद सेल के फ़ॉन्ट साइज़ दिखाता है. |
get | String | रेंज के सबसे ऊपर बाएं कोने में मौजूद सेल का फ़ॉन्ट स्टाइल ('italic' या 'normal' ) दिखाता है. |
get | String[][] | यह फ़ंक्शन, रेंज में मौजूद सेल के फ़ॉन्ट स्टाइल दिखाता है. |
get | String | रेंज के सबसे ऊपर बाएं कोने में मौजूद सेल का फ़ॉन्ट वेट (सामान्य/बोल्ड) दिखाता है. |
get | String[][] | यह फ़ंक्शन, रेंज में मौजूद सेल के फ़ॉन्ट वेट दिखाता है. |
get | String | रेंज की सबसे ऊपर बाईं ओर मौजूद सेल का फ़ॉर्मूला (A1 नोटेशन) दिखाता है. अगर सेल खाली है या उसमें कोई फ़ॉर्मूला नहीं है, तो यह खाली स्ट्रिंग दिखाता है. |
get | String | किसी सेल के लिए फ़ॉर्मूला (R1C1 नोटेशन) दिखाता है. अगर कोई फ़ॉर्मूला नहीं है, तो null दिखाता है. |
get | String[][] | रेंज में मौजूद सेल के फ़ॉर्मूला (A1 नोटेशन) दिखाता है. |
get | String[][] | रेंज में मौजूद सेल के लिए फ़ॉर्मूला (R1C1 नोटेशन) दिखाता है. |
get | Integer | रेंज की पैरंट शीट का ग्रिड आईडी दिखाता है. |
get | Integer | रेंज की ऊंचाई दिखाता है. |
get | String | रेंज के सबसे ऊपर बाएं कोने में मौजूद सेल के टेक्स्ट का हॉरिज़ॉन्टल अलाइनमेंट (लेफ़्ट/सेंटर/राइट) दिखाता है. |
get | String[][] | रेंज में मौजूद सेल के हॉरिज़ॉन्टल अलाइनमेंट दिखाता है. |
get | Integer | कॉलम के आखिर की पोज़िशन दिखाता है. |
get | Integer | लाइन के आखिर की पोज़िशन दिखाता है. |
get | Range[] | मर्ज की गई उन सेल को दिखाने वाले Range ऑब्जेक्ट का ऐरे दिखाता है जो पूरी तरह से मौजूदा रेंज में हों या जिनमें मौजूदा रेंज में कम से कम एक सेल हो. |
get | Range | यह फ़ंक्शन, रेंज के पहले कॉलम और पंक्ति में मौजूद सेल से शुरू होकर, दी गई दिशा में अगली सेल दिखाता है. यह सेल, डेटा वाली सेल की एक जैसी रेंज के किनारे पर होती है या उस दिशा में स्प्रेडशीट के किनारे पर होती है. |
get | String | दी गई रेंज से जुड़ा नोट दिखाता है. |
get | String[][] | रेंज में मौजूद सेल से जुड़े नोट दिखाता है. |
get | Integer | इस रेंज में कॉलम की संख्या दिखाता है. |
get | Integer | इस रेंज में पंक्तियों की संख्या दिखाता है. |
get | String | दी गई रेंज की सबसे ऊपर बाईं सेल की संख्या या तारीख की फ़ॉर्मैटिंग पाएं. |
get | String[][] | यह फ़ंक्शन, रेंज में मौजूद सेल के लिए संख्या या तारीख के फ़ॉर्मैट दिखाता है. |
get | Rich | यह रेंज की सबसे ऊपर बाईं ओर मौजूद सेल के लिए, रिच टेक्स्ट वैल्यू दिखाता है. अगर सेल की वैल्यू टेक्स्ट नहीं है, तो यह null दिखाता है. |
get | Rich | रेंज में मौजूद सेल के लिए, रिच टेक्स्ट वैल्यू दिखाता है. |
get | Integer | इस रेंज की पंक्ति की पोज़िशन दिखाता है. |
get | Integer | इस रेंज की पंक्ति की पोज़िशन दिखाता है. |
get | Sheet | यह उस शीट को दिखाता है जिससे यह रेंज जुड़ी है. |
get | Text | रेंज की सबसे ऊपर बाईं सेल के लिए, टेक्स्ट की दिशा दिखाता है. |
get | Text | रेंज में मौजूद सेल के लिए टेक्स्ट की दिशाएं दिखाता है. |
get | Text | रेंज की सबसे ऊपर बाईं सेल के लिए, टेक्स्ट घुमाने की सेटिंग दिखाता है. |
get | Text | रेंज में मौजूद सेल के लिए, टेक्स्ट घुमाने की सेटिंग दिखाता है. |
get | Text | रेंज की सबसे ऊपर बाईं सेल के लिए टेक्स्ट स्टाइल दिखाता है. |
get | Text | रेंज में मौजूद सेल के लिए टेक्स्ट स्टाइल दिखाता है. |
get | Object | रेंज में सबसे ऊपर बाईं ओर मौजूद सेल की वैल्यू दिखाता है. |
get | Object[][] | इस रेंज के लिए, वैल्यू का रेक्टैंगल ग्रिड दिखाता है. |
get | String | रेंज के सबसे ऊपर बाएं कोने में मौजूद सेल का वर्टिकल अलाइनमेंट (ऊपर/बीच/नीचे) दिखाता है. |
get | String[][] | रेंज में मौजूद सेल के वर्टिकल अलाइनमेंट दिखाता है. |
get | Integer | कॉलम में रेंज की चौड़ाई दिखाता है. |
get | Boolean | यह बताता है कि सेल में मौजूद टेक्स्ट रैप हुआ है या नहीं. |
get | Wrap | रेंज में मौजूद सेल के लिए, टेक्स्ट रैप करने की रणनीतियां दिखाता है. |
get | Wrap | रेंज की सबसे ऊपर बाईं सेल के लिए, टेक्स्ट रैप करने की रणनीति दिखाता है. |
get | Boolean[][] | यह बताता है कि सेल में टेक्स्ट रैप हुआ है या नहीं. |
insert | Range | इस रेंज में खाली सेल डालता है. |
insert | Range | रेंज की हर सेल में चेकबॉक्स डालता है. चुने गए चेकबॉक्स के लिए true और चुने नहीं गए चेकबॉक्स के लिए false का इस्तेमाल किया जाता है. |
insert | Range | यह फ़ंक्शन, रेंज की हर सेल में चेकबॉक्स डालता है. ये चेकबॉक्स, चुने गए विकल्प के लिए कस्टम वैल्यू और चुने नहीं गए विकल्प के लिए खाली स्ट्रिंग के साथ कॉन्फ़िगर किए जाते हैं. |
insert | Range | यह फ़ंक्शन, रेंज में मौजूद हर सेल में चेकबॉक्स डालता है. ये चेकबॉक्स, चुने गए और नहीं चुने गए स्टेटस के लिए कस्टम वैल्यू के साथ कॉन्फ़िगर किए जाते हैं. |
is | Boolean | अगर रेंज पूरी तरह से खाली है, तो true दिखाता है. |
is | Boolean | यह बताता है कि रेंज में मौजूद सभी सेल के चेकबॉक्स की स्थिति 'चेक किया गया' है या नहीं. |
is | Boolean | यह तय करता है कि रेंज का आखिरी हिस्सा किसी कॉलम से जुड़ा है या नहीं. |
is | Boolean | यह तय करता है कि रेंज का आखिरी हिस्सा किसी पंक्ति से जुड़ा है या नहीं. |
is | Boolean | अगर मौजूदा रेंज में मौजूद सेल, मर्ज की गई किसी सेल से ओवरलैप होती हैं, तो true दिखाता है. |
is | Boolean | यह तय करता है कि रेंज की शुरुआत किसी खास कॉलम से जुड़ी है या नहीं. |
is | Boolean | यह तय करता है कि रेंज की शुरुआत किसी खास पंक्ति से हुई है या नहीं. |
merge() | Range | रेंज में मौजूद सेल को एक ब्लॉक में मर्ज करता है. |
merge | Range | रेंज में मौजूद सेल को रेंज के कॉलम में मर्ज करें. |
merge | Range | रेंज में मौजूद सेल को एक साथ मर्ज करता है. |
move | void | इस रेंज से टारगेट रेंज में, फ़ॉर्मैट और वैल्यू, दोनों को काटकर चिपकाएं. |
offset(rowOffset, columnOffset) | Range | यह फ़ंक्शन एक नई रेंज दिखाता है, जो इस रेंज से पंक्तियों और कॉलम की दी गई संख्या (जो नेगेटिव हो सकती है) के हिसाब से ऑफ़सेट होती है. |
offset(rowOffset, columnOffset, numRows) | Range | यह फ़ंक्शन, मौजूदा रेंज के हिसाब से एक नई रेंज दिखाता है. इस रेंज का सबसे ऊपर बाईं ओर मौजूद पॉइंट, मौजूदा रेंज से दी गई पंक्तियों और कॉलम के हिसाब से ऑफ़सेट होता है. साथ ही, सेल में दी गई ऊंचाई के हिसाब से भी ऑफ़सेट होता है. |
offset(rowOffset, columnOffset, numRows, numColumns) | Range | यह फ़ंक्शन, मौजूदा रेंज के हिसाब से एक नई रेंज दिखाता है. इस रेंज का ऊपरी बायां हिस्सा, मौजूदा रेंज से दी गई पंक्तियों और कॉलम के हिसाब से ऑफ़सेट होता है. साथ ही, सेल में दी गई ऊंचाई और चौड़ाई के हिसाब से भी ऑफ़सेट होता है. |
protect() | Protection | यह एक ऑब्जेक्ट बनाता है, जो रेंज में बदलाव करने से रोक सकता है. हालांकि, जिन उपयोगकर्ताओं के पास अनुमति है वे बदलाव कर सकते हैं. |
randomize() | Range | यह फ़ंक्शन, दी गई रेंज में पंक्तियों के क्रम को रैंडम कर देता है. |
remove | Range | रेंज से सभी चेकबॉक्स हटा देता है. |
remove | Range | इस रेंज में मौजूद उन पंक्तियों को हटाता है जिनमें वैल्यू, किसी पिछली पंक्ति की वैल्यू की डुप्लीकेट होती हैं. |
remove | Range | इस रेंज में मौजूद उन पंक्तियों को हटाता है जिनमें तय किए गए कॉलम में वैल्यू मौजूद हों और वे किसी पिछली पंक्ति की वैल्यू की डुप्लीकेट हों. |
set | Range | सीएसएस नोटेशन (जैसे, '#ffffff'
या 'white' ) में, रेंज की सभी सेल का बैकग्राउंड कलर सेट करता है. |
set | Range | रेंज में मौजूद सभी सेल का बैकग्राउंड कलर सेट करता है. |
set | Range | बैकग्राउंड के रंगों का रेक्टैंगल ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खाना चाहिए. |
set | Range | आरजीबी वैल्यू (0 से 255 के बीच के पूर्णांक) का इस्तेमाल करके, बैकग्राउंड को दिए गए रंग पर सेट करता है. |
set | Range | बैकग्राउंड के रंगों का रेक्टैंगल ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खाना चाहिए. |
set | Range | बॉर्डर प्रॉपर्टी सेट करता है. |
set | Range | बॉर्डर प्रॉपर्टी को कलर और/या स्टाइल के साथ सेट करता है. |
set | Range | यह रेंज में मौजूद सभी सेल के लिए, डेटा की पुष्टि करने का एक नियम सेट करता है. |
set | Range | यह रेंज में मौजूद सभी सेल के लिए, डेटा की पुष्टि करने के नियम सेट करता है. |
set | Range | सीएसएस नोटेशन (जैसे, '#ffffff' या 'white' ) में फ़ॉन्ट का रंग सेट करता है. |
set | Range | दी गई रेंज के फ़ॉन्ट का रंग सेट करता है. |
set | Range | फ़ॉन्ट के रंगों का एक आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खाना चाहिए. |
set | Range | फ़ॉन्ट के रंगों का एक आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खाना चाहिए. |
set | Range | फ़ॉन्ट फ़ैमिली का एक आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खाना चाहिए. |
set | Range | "Arial" या "Helvetica" जैसे फ़ॉन्ट फ़ैमिली सेट करता है. |
set | Range | दी गई रेंज ('underline' , 'line-through' या
'none' ) के फ़ॉन्ट की लाइन स्टाइल सेट करता है. |
set | Range | लाइन स्टाइल का आयताकार ग्रिड सेट करता है. यह इस रेंज के डाइमेंशन से मेल खाना चाहिए. |
set | Range | फ़ॉन्ट का साइज़ सेट करता है. साइज़, पॉइंट साइज़ में होता है. |
set | Range | फ़ॉन्ट साइज़ का एक आयताकार ग्रिड सेट करता है. यह इस रेंज के डाइमेंशन से मेल खाना चाहिए. |
set | Range | दी गई रेंज ('italic' या 'normal' ) के लिए फ़ॉन्ट स्टाइल सेट करें. |
set | Range | फ़ॉन्ट स्टाइल का एक आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खाना चाहिए. |
set | Range | दी गई रेंज के लिए फ़ॉन्ट वेट (सामान्य/बोल्ड) सेट करें. |
set | Range | फ़ॉन्ट वेट का एक आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खाना चाहिए. |
set | Range | इस रेंज के लिए फ़ॉर्मूला अपडेट करता है. |
set | Range | इस रेंज के लिए फ़ॉर्मूला अपडेट करता है. |
set | Range | फ़ॉर्मूला का एक आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खाना चाहिए. |
set | Range | फ़ॉर्मूला का एक आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खाना चाहिए. |
set | Range | दी गई रेंज (बायां/मध्य/दायां) के लिए, हॉरिज़ॉन्टल (बाएं से दाएं) अलाइनमेंट सेट करें. |
set | Range | हॉरिज़ॉन्टल अलाइनमेंट का रेक्टैंगल ग्रिड सेट करता है. |
set | Range | नोट को दी गई वैल्यू पर सेट करता है. |
set | Range | नोट का आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खाना चाहिए. |
set | Range | संख्या या तारीख के फ़ॉर्मैट को, दी गई फ़ॉर्मैटिंग स्ट्रिंग पर सेट करता है. |
set | Range | संख्या या तारीख के फ़ॉर्मैट का एक आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खाना चाहिए. |
set | Range | रेंज में मौजूद सेल के लिए, रिच टेक्स्ट वैल्यू सेट करता है. |
set | Range | रिच टेक्स्ट वैल्यू का एक आयताकार ग्रिड सेट करता है. |
set | Range | इससे यह सेट होता है कि रेंज में हाइपरलिंक दिखाने हैं या नहीं. |
set | Range | रेंज में मौजूद सेल के लिए टेक्स्ट की दिशा सेट करता है. |
set | Range | टेक्स्ट डायरेक्शन का आयताकार ग्रिड सेट करता है. |
set | Range | रेंज में मौजूद सेल के लिए, टेक्स्ट रोटेशन की सेटिंग सेट करता है. |
set | Range | रेंज में मौजूद सेल के लिए, टेक्स्ट रोटेशन की सेटिंग सेट करता है. |
set | Range | टेक्स्ट रोटेशन का एक आयताकार ग्रिड सेट करता है. |
set | Range | इस विकल्प से, रेंज में मौजूद सेल के लिए टेक्स्ट स्टाइल सेट की जाती है. |
set | Range | टेक्स्ट स्टाइल का आयताकार ग्रिड सेट करता है. |
set | Range | रेंज की वैल्यू सेट करता है. |
set | Range | वैल्यू का एक आयताकार ग्रिड सेट करता है. यह इस रेंज के डाइमेंशन से मेल खाना चाहिए. |
set | Range | दी गई रेंज (ऊपर/बीच/नीचे) के लिए, वर्टिकल (ऊपर से नीचे) अलाइनमेंट सेट करें. |
set | Range | वर्टिकल अलाइनमेंट का एक आयताकार ग्रिड सेट करता है. यह इस रेंज के डाइमेंशन से मेल खाना चाहिए. |
set | Range | इससे यह सेट होता है कि रेंज में मौजूद सेल के लिए टेक्स्ट को स्टैक करना है या नहीं. |
set | Range | दी गई रेंज के लिए सेल रैप सेट करें. |
set | Range | रैपिंग की रणनीतियों का रेक्टैंगल ग्रिड सेट करता है. |
set | Range | इस विकल्प से, रेंज में मौजूद सेल के लिए टेक्स्ट रैपिंग की रणनीति सेट की जाती है. |
set | Range | टेक्स्ट रैप करने की नीतियों का एक आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खाना चाहिए. |
shift | Range | रेंज के कॉलम ग्रुपिंग की गहराई को तय की गई रकम से बदलता है. |
shift | Range | रेंज की पंक्ति ग्रुपिंग की गहराई को तय रकम से बदलता है. |
sort(sortSpecObj) | Range | यह फ़ंक्शन, दी गई रेंज में मौजूद सेल को कॉलम और तय किए गए क्रम के हिसाब से क्रम में लगाता है. |
split | void | अपने-आप पहचाने गए डेलिमिटर के आधार पर, टेक्स्ट के कॉलम को कई कॉलम में बांटता है. |
split | void | टेक्स्ट के कॉलम को कई कॉलम में बांटता है. इसके लिए, तय की गई स्ट्रिंग को कस्टम डेलिमिटर के तौर पर इस्तेमाल किया जाता है. |
split | void | तय किए गए डेलिमिटर के आधार पर, टेक्स्ट के कॉलम को कई कॉलम में बांटता है. |
trim | Range | इस रेंज की हर सेल में मौजूद खाली जगह (जैसे, स्पेस, टैब या नई लाइन) को काट देता है. |
uncheck() | Range | यह फ़ंक्शन, रेंज में मौजूद चेकबॉक्स की स्थिति को “चेक नहीं किया गया” में बदल देता है. |
अब काम न करने वाले तरीके
तरीका | रिटर्न टाइप | संक्षिप्त विवरण |
---|---|---|
| String | रेंज के सबसे ऊपर बाएं कोने में मौजूद सेल के फ़ॉन्ट का कलर, सीएसएस नोटेशन (जैसे कि '#ffffff' या 'white' ) में दिखाता है. |
| String[][] | यह फ़ंक्शन, सीएसएस नोटेशन (जैसे कि '#ffffff' या
'white' ) में, रेंज में मौजूद सेल के फ़ॉन्ट के रंग दिखाता है. |
ज़्यादा जानकारी वाला दस्तावेज़
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());
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
key | String | नए डेवलपर मेटाडेटा की कुंजी. |
वापसी का टिकट
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());
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
key | String | नए डेवलपर मेटाडेटा की कुंजी. |
visibility | Developer | नए डेवलपर मेटाडेटा की दिखने की सेटिंग. |
वापसी का टिकट
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());
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
key | String | नए डेवलपर मेटाडेटा की कुंजी. |
value | String | नए डेवलपर मेटाडेटा की वैल्यू. |
वापसी का टिकट
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());
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
key | String | नए डेवलपर मेटाडेटा की कुंजी. |
value | String | नए डेवलपर मेटाडेटा की वैल्यू. |
visibility | Developer | नए डेवलपर मेटाडेटा की दिखने की सेटिंग. |
वापसी का टिकट
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(),
);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
banding | Banding | रेंज में मौजूद कॉलम पर लागू करने के लिए रंग की थीम. |
वापसी का टिकट
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(),
);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
banding | Banding | रेंज में मौजूद कॉलम पर लागू करने के लिए रंग की थीम. |
show | Boolean | अगर true है, तो बैंडिंग थीम हेडर का रंग पहले कॉलम पर लागू होता है. |
show | Boolean | अगर 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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
banding | Banding | रेंज में मौजूद लाइनों पर लागू करने के लिए रंग की थीम. |
वापसी का टिकट
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
banding | Banding | रेंज में मौजूद लाइनों पर लागू करने के लिए रंग की थीम. |
show | Boolean | अगर true है, तो पहली पंक्ति पर बैंडिंग थीम हेडर का रंग लागू होता है. |
show | Boolean | अगर true है, तो बैंडिंग थीम के फ़ुटर का रंग आखिरी लाइन पर लागू होता है. |
वापसी का टिकट
Banding
— नई बैंडिंग.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
autoFill(destination, series)
इस रेंज में मौजूद डेटा के आधार पर, destination
को डेटा से भरता है. नई वैल्यू, तय किए गए 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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
destination | Range | वह रेंज जिसमें वैल्यू अपने-आप भरनी हैं. डेस्टिनेशन रेंज में यह रेंज शामिल होनी चाहिए और इसे सिर्फ़ एक दिशा (ऊपर, नीचे, बाईं या दाईं) में बढ़ाया जाना चाहिए. |
series | Auto | नई वैल्यू का हिसाब लगाने के लिए, ऑटोमैटिक भरने की उस सीरीज़ का टाइप जिसका इस्तेमाल किया जाना चाहिए. सोर्स डेटा के टाइप और मात्रा के आधार पर, इस सीरीज़ का असर अलग-अलग होता है. |
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
series | Auto | नई वैल्यू का हिसाब लगाने के लिए, ऑटोमैटिक भरने की उस सीरीज़ का टाइप जिसका इस्तेमाल किया जाना चाहिए. सोर्स डेटा के टाइप और मात्रा के आधार पर, इस सीरीज़ का असर अलग-अलग होता है. |
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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());
वापसी का टिकट
Boolean
— true
, अगर उपयोगकर्ता के पास रेंज में मौजूद हर सेल में बदलाव करने की अनुमति है; 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
});
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
options | Object | एक JavaScript ऑब्जेक्ट, जो बेहतर पैरामीटर के बारे में बताता है, जैसा कि नीचे दिया गया है. |
उन्नत पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
comments | Boolean | सिर्फ़ टिप्पणियां मिटानी हैं या नहीं. |
contents | Boolean | सिर्फ़ कॉन्टेंट मिटाना है या नहीं. |
format | Boolean | सिर्फ़ फ़ॉर्मैट मिटाना है या नहीं; ध्यान दें कि फ़ॉर्मैट मिटाने पर, डेटा की पुष्टि करने के नियम भी मिट जाते हैं. |
validations | Boolean | सिर्फ़ डेटा की पुष्टि करने के नियमों को मिटाना है या नहीं. |
skip | Boolean | फ़िल्टर की गई पंक्तियों को हटाने से बचना है या नहीं. |
वापसी का टिकट
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 पैरामीटर के बारे में ज़्यादा जानकारी के लिए, get
देखें.
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
grid | Integer | स्प्रेडशीट में मौजूद शीट का यूनीक आईडी. इस बात से कोई फ़र्क़ नहीं पड़ता कि शीट किस क्रम में है. |
column | Integer | टारगेट रेंज का पहला कॉलम. |
column | Integer | टारगेट रेंज का आखिरी कॉलम. |
row | Integer | टारगेट रेंज की शुरुआती पंक्ति. |
row | Integer | टारगेट रेंज की आखिरी पंक्ति. |
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
sheet | Sheet | टारगेट शीट. |
column | Integer | टारगेट रेंज का पहला कॉलम. |
column | Integer | टारगेट रेंज का आखिरी कॉलम. |
row | Integer | टारगेट रेंज की शुरुआती पंक्ति. |
row | Integer | टारगेट रेंज की आखिरी पंक्ति. |
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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));
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
destination | Range | डेस्टिनेशन रेंज, जिसमें कॉपी करना है. इसमें सिर्फ़ सबसे ऊपर बाईं ओर मौजूद सेल की पोज़िशन काम की है. |
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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,
);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
destination | Range | डेस्टिनेशन रेंज, जिसमें कॉपी करना है. इसमें सिर्फ़ सबसे ऊपर बाईं ओर मौजूद सेल की पोज़िशन काम की है. |
copy | Copy | यह एक टाइप है, जो यह बताता है कि रेंज के कॉन्टेंट को डेस्टिनेशन में कैसे चिपकाया जाता है. |
transposed | Boolean | रेंज को ट्रांसपोज़ किया गया ओरिएंटेशन में चिपकाया जाना चाहिए या नहीं. |
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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});
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
destination | Range | डेस्टिनेशन रेंज, जिसमें कॉपी करना है. इसमें सिर्फ़ सबसे ऊपर बाईं ओर मौजूद सेल की पोज़िशन काम की है. |
options | Object | एक JavaScript ऑब्जेक्ट, जो बेहतर पैरामीटर के बारे में बताता है, जैसा कि नीचे दिया गया है. |
उन्नत पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
format | Boolean | का मतलब है कि सिर्फ़ फ़ॉर्मैट कॉपी किया जाना चाहिए |
contents | Boolean | इसका मतलब है कि सिर्फ़ कॉन्टेंट को कॉपी किया जाना चाहिए |
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
copyValuesToRange(gridId, column, columnEnd, row, rowEnd)
रेंज के कॉन्टेंट को दी गई जगह पर कॉपी करें. अगर डेस्टिनेशन, सोर्स रेंज से बड़ा या छोटा है, तो सोर्स को उसके हिसाब से दोहराया या छोटा किया जाता है.
gridId पैरामीटर के बारे में ज़्यादा जानकारी के लिए, get
देखें.
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
grid | Integer | स्प्रेडशीट में मौजूद शीट का यूनीक आईडी. इस बात से कोई फ़र्क़ नहीं पड़ता कि शीट किस क्रम में है. |
column | Integer | टारगेट रेंज का पहला कॉलम. |
column | Integer | टारगेट रेंज का आखिरी कॉलम. |
row | Integer | टारगेट रेंज की शुरुआती पंक्ति. |
row | Integer | टारगेट रेंज की आखिरी पंक्ति. |
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
sheet | Sheet | टारगेट शीट. |
column | Integer | टारगेट रेंज का पहला कॉलम. |
column | Integer | टारगेट रेंज का आखिरी कॉलम. |
row | Integer | टारगेट रेंज की शुरुआती पंक्ति. |
row | Integer | टारगेट रेंज की आखिरी पंक्ति. |
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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(),
);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
data | Data | पिवट टेबल बनाने के लिए डेटा सोर्स. |
वापसी का टिकट
Data
— नया डेटा सोर्स पिवट टेबल.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
data | Data | पिवट टेबल बनाने के लिए डेटा सोर्स. |
वापसी का टिकट
Data
— नई बनाई गई डेटा सोर्स टेबल.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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());
वापसी का टिकट
Developer
— इस रेंज के दायरे में मेटाडेटा खोजने के लिए, डेवलपर मेटाडेटा फ़ाइंडर.
createFilter()
यह फ़ंक्शन एक फ़िल्टर बनाता है और उसे शीट की तय की गई रेंज पर लागू करता है. किसी शीट पर एक से ज़्यादा फ़िल्टर नहीं बनाए जा सकते. फ़िल्टर बनाने के बाद, उसे ऐक्सेस करने और उसमें बदलाव करने के लिए, get
या 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
शीट के लिए फ़िल्टर बनाएं. यह शीट का डिफ़ॉल्ट टाइप होता है.
ग्रिड शीट ऐसी शीट होती हैं जो किसी डेटाबेस से कनेक्ट नहीं होतीं. अन्य तरह के फ़िल्टर बनाने के लिए,
यहां दी गई जानकारी देखें:
Pivot
की मदद से पिवट टेबल फ़िल्टर बनानाTable.addFilter(sourceDataColumn, filterCriteria) Data
की मदद से, डेटाबेस से कनेक्ट की गई शीट के लिए फ़िल्टर बनानाSource Sheet.addFilter(columnName, filterCriteria) Data
की मदद से, डेटाबेस से कनेक्ट की गई पिवट टेबल के लिए फ़िल्टर बनानाSource Pivot Table.addFilter(columnName, filterCriteria)
वापसी का टिकट
Filter
— नया फ़िल्टर.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
createPivotTable(sourceData)
इस रेंज में पहली सेल पर ऐंकर की गई source
से, खाली पिवट टेबल बनाता है.
// 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());
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
source | Range | पिवट टेबल बनाने के लिए डेटा. |
वापसी का टिकट
Pivot
— नया बनाया गया Pivot
.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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');
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
find | String | वह टेक्स्ट जिसे खोजना है. |
वापसी का टिकट
Text
— रेंज के लिए Text
deleteCells(shiftDimension)
सेल की इस रेंज को मिटाता है. दिए गए डाइमेंशन के साथ शीट में मौजूद डेटा, मिटाई गई रेंज में शिफ़्ट हो जाता है.
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('A1:D10');
range.deleteCells(SpreadsheetApp.Dimension.COLUMNS);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
shift | Dimension | वह डाइमेंशन जिस पर मौजूदा डेटा को शिफ़्ट करना है. |
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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());
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
row | Integer | रेंज के हिसाब से सेल की पंक्ति. |
column | Integer | रेंज के हिसाब से सेल का कॉलम. |
वापसी का टिकट
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(),
);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
dimension | Dimension | वह डाइमेंशन जिसकी मदद से रेंज को बड़ा करना है. |
वापसी का टिकट
Range
— रेंज का डेटा क्षेत्र या ओरिजनल रेंज के हर कॉलम या हर पंक्ति को कवर करने वाली रेंज.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getDataSourceFormula()
रेंज में पहली सेल के लिए Data
दिखाता है. अगर सेल में डेटा सोर्स का फ़ॉर्मूला नहीं है, तो 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);
वापसी का टिकट
Data
— सेल के लिए Data
.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getDataSourceFormulas()
रेंज में मौजूद सेल के लिए Data
दिखाता है.
// 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());
वापसी का टिकट
Data
— Data
का ऐरे.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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());
वापसी का टिकट
Data
— डेटा सोर्स की पिवट टेबल की सूची.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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());
वापसी का टिकट
Data
— डेटा सोर्स टेबल की सूची.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getDataSourceUrl()
इस रेंज में मौजूद डेटा का यूआरएल दिखाता है. इसका इस्तेमाल चार्ट और क्वेरी बनाने के लिए किया जा सकता है.
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();
}
<!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();
वापसी का टिकट
Data
— डेटा को डेटाटेबल के तौर पर दिखाता है.
getDataTable(firstRowIsHeader)
इस रेंज में मौजूद डेटा को डेटाटेबल के तौर पर दिखाता है.
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();
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
first | Boolean | पहली पंक्ति को हेडर के तौर पर इस्तेमाल करना है या नहीं. |
वापसी का टिकट
Data
— डेटा को डेटाटेबल के तौर पर दिखाना.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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.');
}
वापसी का टिकट
Data
— रेंज में सबसे ऊपर बाईं ओर मौजूद सेल के लिए, डेटा की पुष्टि करने का नियम.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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);
वापसी का टिकट
Data
— रेंज में मौजूद सेल से जुड़े, डेटा की पुष्टि करने के नियमों का दो डाइमेंशन वाला ऐरे.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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()}`);
}
वापसी का टिकट
Developer
— इस रेंज से जुड़ा डेवलपर मेटाडेटा.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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());
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
direction | Direction | वह दिशा जिसमें डेटा क्षेत्र की अगली आखिरी सेल ढूंढनी है. |
वापसी का टिकट
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());
वापसी का टिकट
Rich
— रेंज में सबसे ऊपर बाईं ओर मौजूद सेल की रिच टेक्स्ट वैल्यू या अगर सेल की वैल्यू टेक्स्ट नहीं है, तो 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());
}
}
वापसी का टिकट
Rich
— रिच टेक्स्ट वैल्यू का दो-आयामी कलेक्शन.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getRow()
इस रेंज की पंक्ति की पोज़िशन दिखाता है. यह get
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()
इस रेंज की पंक्ति की पोज़िशन दिखाता है. यह get
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());
वापसी का टिकट
Text
— रेंज में सबसे ऊपर बाईं ओर मौजूद सेल का टेक्स्ट डायरेक्शन.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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]);
}
}
वापसी का टिकट
Text
— टेक्स्ट निर्देशों का दो-आयामी कलेक्शन.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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());
वापसी का टिकट
Text
— टेक्स्ट रोटेशन की सेटिंग.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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);
}
}
वापसी का टिकट
Text
— रेंज में मौजूद सेल से जुड़े टेक्स्ट रोटेशन का दो-आयामी ऐरे.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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);
वापसी का टिकट
Text
— रेंज में सबसे ऊपर बाईं ओर मौजूद सेल का टेक्स्ट स्टाइल.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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]);
}
}
वापसी का टिकट
Text
— टेक्स्ट स्टाइल का दो-आयामी कलेक्शन.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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()
किसी वेब ऐप्लिकेशन में डेटा नहीं दिखाता. इसके बजाय, शीट से मिली सभी वैल्यू को Number
, Boolean
या String
जैसे काम करने वाले JavaScript प्राइमटिव में बदलें.वापसी का टिकट
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()
यह बताता है कि सेल में मौजूद टेक्स्ट रैप हुआ है या नहीं. रैप की रणनीति के बारे में ज़्यादा जानने के लिए, get
का इस्तेमाल करें.
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]);
}
}
वापसी का टिकट
Wrap
— टेक्स्ट रैप करने की रणनीतियों का दो-आयामी कलेक्शन.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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());
वापसी का टिकट
Wrap
— रेंज में सबसे ऊपर बाईं ओर मौजूद सेल के लिए, टेक्स्ट रैप करने की रणनीति.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getWraps()
यह बताता है कि सेल में टेक्स्ट रैप हुआ है या नहीं. रैप की रणनीति के बारे में ज़्यादा जानने के लिए, get
का इस्तेमाल करें.
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
shift | Dimension | वह डाइमेंशन जिस पर मौजूदा डेटा को शिफ़्ट करना है. |
वापसी का टिकट
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');
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
checked | Object | डेटा की पुष्टि करने वाले चेकबॉक्स के लिए चुनी गई वैल्यू. |
वापसी का टिकट
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');
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
checked | Object | डेटा की पुष्टि करने वाले चेकबॉक्स के लिए चुनी गई वैल्यू. |
unchecked | Object | चेकबॉक्स की डेटा की पुष्टि के लिए, चुने न गए विकल्प की वैल्यू. |
वापसी का टिकट
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();
वापसी का टिकट
Boolean
— true
, अगर रेंज में सभी सेल पर सही का निशान लगा है, 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());
वापसी का टिकट
Boolean
— true
अगर रेंज का आखिरी हिस्सा किसी कॉलम से जुड़ा है, तो 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());
वापसी का टिकट
Boolean
— true
अगर रेंज का आखिरी हिस्सा किसी खास पंक्ति तक सीमित है, तो 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'));
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
target | Range | वह टारगेट रेंज जिसमें इस रेंज को कॉपी करना है. इसमें सिर्फ़ सबसे ऊपर बाईं ओर मौजूद सेल की पोज़िशन का ही इस्तेमाल किया जाता है. |
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
row | Integer | रेंज की सबसे ऊपर बाईं सेल से नीचे की पंक्तियों की संख्या. नेगेटिव वैल्यू, रेंज की सबसे ऊपर बाईं सेल से ऊपर की पंक्तियों को दिखाती हैं. |
column | Integer | रेंज की सबसे ऊपर बाईं सेल के दाईं ओर मौजूद कॉलम की संख्या. नेगेटिव वैल्यू, रेंज की सबसे ऊपर बाईं सेल के बाईं ओर मौजूद कॉलम की संख्या दिखाती हैं. |
वापसी का टिकट
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
row | Integer | रेंज की सबसे ऊपर बाईं सेल से नीचे की पंक्तियों की संख्या. नेगेटिव वैल्यू, रेंज की सबसे ऊपर बाईं सेल से ऊपर की पंक्तियों को दिखाती हैं. |
column | Integer | रेंज की सबसे ऊपर बाईं सेल के दाईं ओर मौजूद कॉलम की संख्या. नेगेटिव वैल्यू, रेंज की सबसे ऊपर बाईं सेल के बाईं ओर मौजूद कॉलम की संख्या दिखाती हैं. |
num | Integer | नई रेंज की पंक्तियों की ऊंचाई. |
वापसी का टिकट
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
row | Integer | रेंज की सबसे ऊपर बाईं सेल से नीचे की पंक्तियों की संख्या. नेगेटिव वैल्यू, रेंज की सबसे ऊपर बाईं सेल से ऊपर की पंक्तियों को दिखाती हैं. |
column | Integer | रेंज की सबसे ऊपर बाईं सेल के दाईं ओर मौजूद कॉलम की संख्या. नेगेटिव वैल्यू, रेंज की सबसे ऊपर बाईं सेल के बाईं ओर मौजूद कॉलम की संख्या दिखाती हैं. |
num | Integer | नई रेंज की पंक्तियों की ऊंचाई. |
num | Integer | नई रेंज के कॉलम की चौड़ाई. |
वापसी का टिकट
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]);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
columns | Integer[] | डुप्लीकेट वैल्यू का विश्लेषण करने के लिए कॉलम. अगर कोई कॉलम नहीं दिया गया है, तो सभी कॉलम का विश्लेषण डुप्लीकेट के लिए किया जाता है. |
वापसी का टिकट
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');
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
color | String | सीएसएस नोटेशन में रंग कोड (जैसे कि '#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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
color | Color | बैकग्राउंड का रंग सेट करने के लिए; 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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
color | Color[][] | रंगों का दो-आयामी कलेक्शन; 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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
red | Integer | आरजीबी नोटेशन में लाल रंग की वैल्यू. |
green | Integer | आरजीबी नोटेशन में हरी वैल्यू. |
blue | Integer | आरजीबी नोटेशन में नीले रंग की वैल्यू. |
वापसी का टिकट
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
color | String[][] | सीएसएस नोटेशन में रंगों का दो डाइमेंशन वाला ऐरे (जैसे कि '#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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
top | Boolean | बॉर्डर के लिए true , कोई नहीं के लिए false , और कोई बदलाव नहीं के लिए null . |
left | Boolean | बॉर्डर के लिए true , कोई नहीं के लिए false , और कोई बदलाव नहीं के लिए null . |
bottom | Boolean | बॉर्डर के लिए true , कोई नहीं के लिए false , और कोई बदलाव नहीं के लिए null . |
right | Boolean | बॉर्डर के लिए true , कोई नहीं के लिए false , और कोई बदलाव नहीं के लिए null . |
vertical | Boolean | अंदरूनी वर्टिकल बॉर्डर के लिए true , कोई बॉर्डर नहीं के लिए false , और कोई बदलाव नहीं के लिए null . |
horizontal | Boolean | अंदरूनी हॉरिज़ॉन्टल बॉर्डर के लिए true , कोई बॉर्डर नहीं के लिए 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,
);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
top | Boolean | बॉर्डर के लिए true , कोई नहीं के लिए false , और कोई बदलाव नहीं के लिए null . |
left | Boolean | बॉर्डर के लिए true , कोई नहीं के लिए false , और कोई बदलाव नहीं के लिए null . |
bottom | Boolean | बॉर्डर के लिए true , कोई नहीं के लिए false , और कोई बदलाव नहीं के लिए null . |
right | Boolean | बॉर्डर के लिए true , कोई नहीं के लिए false , और कोई बदलाव नहीं के लिए null . |
vertical | Boolean | अंदरूनी वर्टिकल बॉर्डर के लिए true , कोई बॉर्डर नहीं के लिए false , और कोई बदलाव नहीं के लिए null . |
horizontal | Boolean | अंदरूनी हॉरिज़ॉन्टल बॉर्डर के लिए true , कोई बॉर्डर नहीं के लिए false , और कोई बदलाव नहीं के लिए null . |
color | String | सीएसएस नोटेशन में रंग (जैसे, '#ffffff' या 'white' ), डिफ़ॉल्ट रंग (काला) के लिए null . |
style | Border | बॉर्डर के लिए स्टाइल, डिफ़ॉल्ट स्टाइल (सॉलिड) के लिए 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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
rule | Data | डेटा की पुष्टि करने का नियम सेट करने के लिए या डेटा की पुष्टि करने की सुविधा हटाने के लिए 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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
rules | Data | डेटा की पुष्टि के लिए सेट किए जाने वाले नियमों का दो-आयामी कलेक्शन; 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');
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
color | String | सीएसएस नोटेशन में फ़ॉन्ट का रंग (जैसे, '#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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
color | Color | फ़ॉन्ट का रंग सेट करने के लिए; 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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
colors | Color[][] | रंगों का दो-आयामी कलेक्शन; 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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
colors | Object[][] | सीएसएस नोटेशन में रंगों का दो डाइमेंशन वाला ऐरे (जैसे कि '#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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
font | Object[][] | फ़ॉन्ट फ़ैमिली का दो-आयामी कलेक्शन; 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');
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
font | String | सेट की जाने वाली फ़ॉन्ट फ़ैमिली; 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');
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
font | String | फ़ॉन्ट लाइन स्टाइल, '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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
font | Object[][] | फ़ॉन्ट लाइन स्टाइल ('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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
size | Integer | पॉइंट साइज़ में फ़ॉन्ट साइज़. |
वापसी का टिकट
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
sizes | Object[][] | साइज़ का दो डाइमेंशन वाला ऐरे. |
वापसी का टिकट
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');
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
font | String | फ़ॉन्ट स्टाइल, '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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
font | Object[][] | फ़ॉन्ट स्टाइल का दो-आयामी कलेक्शन, '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');
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
font | String | फ़ॉन्ट की मोटाई, '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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
font | Object[][] | फ़ॉन्ट वेट का दो डाइमेंशन वाला कलेक्शन, '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)');
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
formula | String | सेल के लिए सेट किए जाने वाले फ़ॉर्मूला को दिखाने वाली स्ट्रिंग. |
वापसी का टिकट
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])');
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
formula | String | स्ट्रिंग फ़ॉर्मूला. |
वापसी का टिकट
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
formulas | String[][] | फ़ॉर्मूलों का दो-डाइमेंशन वाला स्ट्रिंग कलेक्शन. |
वापसी का टिकट
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
formulas | String[][] | 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');
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
alignment | String | अलाइनमेंट, 'left' , 'center' या 'normal' में से कोई एक;
null वैल्यू, अलाइनमेंट को रीसेट करती है. |
वापसी का टिकट
Range
— चेन बनाने के लिए यह रेंज.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setHorizontalAlignments(alignments)
हॉरिज़ॉन्टल अलाइनमेंट का एक आयताकार ग्रिड सेट करता है. set
देखें
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
alignments | Object[][] | अलाइनमेंट का दो-आयामी कलेक्शन, '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');
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
note | String | रेंज के लिए सेट की जाने वाली नोट वैल्यू; 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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
notes | Object[][] | नोट का दो-आयामी कलेक्शन; 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');
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
number | String | संख्या के फ़ॉर्मैट की स्ट्रिंग. |
वापसी का टिकट
Range
— चेन बनाने के लिए यह रेंज.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setNumberFormats(numberFormats)
संख्या या तारीख के फ़ॉर्मैट का एक आयताकार ग्रिड सेट करता है. यह ग्रिड, इस रेंज के डाइमेंशन से मेल खाना चाहिए. वैल्यू, फ़ॉर्मैट पैटर्न स्ट्रिंग होती हैं, जैसा कि शीट एपीआई दस्तावेज़ में बताया गया है.
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
number | Object[][] | संख्या के फ़ॉर्मैट का दो-आयामी ऐरे. |
वापसी का टिकट
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
value | Rich | रिच टेक्स्ट की मनचाही वैल्यू. |
वापसी का टिकट
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]]);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
values | Rich | रिच टेक्स्ट की वैल्यू. |
वापसी का टिकट
Range
— चेन बनाने के लिए यह रेंज.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setShowHyperlink(showHyperlink)
इससे यह सेट होता है कि रेंज में हाइपरलिंक दिखाने हैं या नहीं.
// 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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
show | Boolean | हाइपरलिंक दिखाना है या नहीं. |
वापसी का टिकट
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
direction | Text | टेक्स्ट की पसंदीदा दिशा; अगर 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());
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
directions | Text | मनचाहे टेक्स्ट निर्देश. अगर कोई निर्देश 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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
degrees | Integer | स्टैंडर्ड ओरिएंटेशन और पसंदीदा ओरिएंटेशन के बीच का ऐंगल. बाएं से दाएं टेक्स्ट के लिए, पॉज़िटिव ऐंगल, घड़ी की सुई के उलट दिशा में होते हैं. |
वापसी का टिकट
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
rotation | Text | टेक्स्ट घुमाने की पसंदीदा सेटिंग. |
वापसी का टिकट
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());
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
rotations | Text | टेक्स्ट घुमाने की पसंदीदा सेटिंग. |
वापसी का टिकट
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
style | Text | टेक्स्ट का मनचाहा स्टाइल. |
वापसी का टिकट
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],
]);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
styles | Text | अपनी पसंद के टेक्स्ट स्टाइल. |
वापसी का टिकट
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
value | Object | रेंज की वैल्यू. |
वापसी का टिकट
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
values | Object[][] | वैल्यू का दो-आयामी ऐरे. |
वापसी का टिकट
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');
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
alignment | String | अलाइनमेंट, '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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
alignments | Object[][] | अलाइनमेंट का दो-डाइमेंशन वाला ऐरे, '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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
is | Boolean | टेक्स्ट को स्टैक करना है या नहीं. |
वापसी का टिकट
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
is | Boolean | टेक्स्ट को रैप करना है या नहीं. |
वापसी का टिकट
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());
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
strategies | Wrap | रैपिंग की पसंदीदा रणनीतियां. |
वापसी का टिकट
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
strategy | Wrap | रैप करने की पसंदीदा रणनीति. |
वापसी का टिकट
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
is | Object[][] | रैप वैरिएबल का दो डाइमेंशन वाला अरे, जो यह तय करता है कि टेक्स्ट को सेल में रैप करना है या नहीं. |
वापसी का टिकट
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
delta | Integer | इस रेंज के कॉलम ग्रुप की गहराई में बदलाव करने के लिए वैल्यू. |
वापसी का टिकट
Range
— चेन बनाने के लिए यह रेंज.
थ्रो
Error
— जब कंट्रोल की पोज़िशन Group
हो, तो पहले कॉलम की डेप्थ बदलने के लिए
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
delta | Integer | इस रेंज के पंक्ति ग्रुप की गहराई में बदलाव करने के लिए वैल्यू. |
वापसी का टिकट
Range
— चेन बनाने के लिए यह रेंज.
थ्रो
Error
— जब कंट्रोल की पोज़िशन Group
हो, तो पहली पंक्ति की डेप्थ बदलने के लिए
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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},
]);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
sort | Object | जिन कॉलम के हिसाब से क्रम से लगाना है. |
वापसी का टिकट
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 |
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
delimiter | String | डेटा को बांटने के लिए इस्तेमाल किया जाने वाला कस्टम डेलिमिटर. |
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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 |
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
delimiter | Text | डेटा को बांटने के लिए प्रीसेट डेलिमिटर. |
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
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()
रेंज में मौजूद चेकबॉक्स की स्थिति को “चेक नहीं किया गया” में बदलता है. रेंज में मौजूद उन सेल को अनदेखा करता है जिनमें फ़िलहाल, चेक की गई या अनचेक की गई वैल्यू कॉन्फ़िगर नहीं है.
// 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
अब काम न करने वाले तरीके
getFontColor()
getFontColor()
अब काम नहीं करता. get
से बदला गया
रेंज के सबसे ऊपर बाएं कोने में मौजूद सेल के फ़ॉन्ट का कलर, सीएसएस नोटेशन (जैसे कि '#ffffff'
या 'white'
) में दिखाता है.
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');
Logger.log(range.getFontColor());
वापसी का टिकट
String
— सीएसएस नोटेशन में फ़ॉन्ट का रंग (जैसे, '#ffffff'
या 'white'
).
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getFontColors()
getFontColors()
अब काम नहीं करता. get
से बदला गया
यह फ़ंक्शन, सीएसएस नोटेशन (जैसे कि '#ffffff'
या
'white'
) में, रेंज में मौजूद सेल के फ़ॉन्ट के रंग दिखाता है.
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheets()[0];
const range = sheet.getRange('B2:D4');
const results = range.getFontColors();
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