Class Spreadsheet

स्प्रेडशीट

Google Sheets की फ़ाइलें ऐक्सेस करें और उनमें बदलाव करें. सामान्य कार्रवाइयों में नई शीट और सहयोगी जोड़ना शामिल है.

तरीके

तरीकारिटर्न टाइपसंक्षिप्त विवरण
addDeveloperMetadata(key)Spreadsheetटॉप लेवल स्प्रेडशीट में, बताई गई कुंजी के साथ डेवलपर मेटाडेटा जोड़ता है.
addDeveloperMetadata(key, visibility)Spreadsheetस्प्रेडशीट में खास कुंजी और 'किसको दिखे' की जानकारी के साथ, डेवलपर मेटाडेटा जोड़ता है.
addDeveloperMetadata(key, value)Spreadsheetस्प्रेडशीट में, बताई गई कुंजी और वैल्यू के साथ डेवलपर मेटाडेटा जोड़ता है.
addDeveloperMetadata(key, value, visibility)Spreadsheetस्प्रेडशीट में खास कुंजी, वैल्यू, और विज़िबिलिटी के साथ डेवलपर मेटाडेटा जोड़ता है.
addEditor(emailAddress)Spreadsheetदिए गए उपयोगकर्ता को Spreadsheet के लिए एडिटर की सूची में जोड़ता है.
addEditor(user)Spreadsheetदिए गए उपयोगकर्ता को Spreadsheet के लिए एडिटर की सूची में जोड़ता है.
addEditors(emailAddresses)Spreadsheetउपयोगकर्ताओं के दिए गए अरे को Spreadsheet के लिए एडिटर की सूची में जोड़ता है.
addMenu(name, subMenus)voidस्प्रेडशीट यूज़र इंटरफ़ेस (यूआई) में एक नया मेन्यू बनाता है.
addViewer(emailAddress)Spreadsheetदिए गए उपयोगकर्ता को Spreadsheet के दर्शकों की सूची में जोड़ता है.
addViewer(user)Spreadsheetदिए गए उपयोगकर्ता को Spreadsheet के दर्शकों की सूची में जोड़ता है.
addViewers(emailAddresses)SpreadsheetSpreadsheet के लिए दर्शकों की सूची में उपयोगकर्ताओं के दिए गए अरे को जोड़ता है.
appendRow(rowContents)Sheetशीट में मौजूदा डेटा क्षेत्र में सबसे नीचे एक लाइन जोड़ता है.
autoResizeColumn(columnPosition)Sheetदिए गए कॉलम की चौड़ाई को इसकी सामग्री के हिसाब से सेट करता है.
copy(name)Spreadsheetस्प्रेडशीट को कॉपी करता है और नई स्प्रेडशीट दिखाता है.
createDeveloperMetadataFinder()DeveloperMetadataFinderइस स्प्रेडशीट के स्कोप में डेवलपर मेटाडेटा ढूंढने के लिए, DeveloperMetadataFinder दिखाता है.
createTextFinder(findText)TextFinderस्प्रेडशीट में टेक्स्ट फ़ाइंडर बनाता है. इसका इस्तेमाल स्प्रेडशीट में टेक्स्ट ढूंढने और उसे बदलने के लिए किया जा सकता है.
deleteActiveSheet()Sheetइस ऐक्टिव शीट को मिटाता है.
deleteColumn(columnPosition)Sheetदिए गए कॉलम की जगह से कॉलम मिटाता है.
deleteColumns(columnPosition, howMany)voidदिए गए कॉलम की जगह से शुरू होने वाले कई कॉलम मिटाता है.
deleteRow(rowPosition)Sheetदी गई पंक्ति की जगह से पंक्ति मिटाता है.
deleteRows(rowPosition, howMany)voidदी गई पंक्ति की जगह से शुरू होने वाली कई पंक्तियां मिटाता है.
deleteSheet(sheet)voidचुनी गई शीट को मिटाता है.
duplicateActiveSheet()Sheetचालू शीट की डुप्लीकेट कॉपी बनाकर, उसे ऐक्टिव शीट में बदल देता है.
getActiveCell()Rangeइस शीट में ऐक्टिव सेल की जानकारी देता है.
getActiveRange()Rangeचालू शीट में चुनी गई रेंज दिखाता है. अगर कोई चालू रेंज नहीं है, तो null दिखाता है.
getActiveRangeList()RangeListकोई सक्रिय रेंज नहीं होने पर, सक्रिय शीट में सक्रिय रेंज की सूची दिखाता है या null.
getActiveSheet()Sheetऐक्टिव शीट को स्प्रेडशीट में दिखाता है.
getAs(contentType)Blobइस ऑब्जेक्ट के अंदर डेटा को, बताए गए कॉन्टेंट टाइप में बदले गए ब्लॉब के तौर पर दिखाएं.
getBandings()Banding[]इस स्प्रेडशीट की सभी बैंडिंग देता है.
getBlob()Blobइस ऑब्जेक्ट के अंदर का डेटा, ब्लॉब के तौर पर दें.
getColumnWidth(columnPosition)Integerदिए गए कॉलम की चौड़ाई को पिक्सल में दिखाता है.
getCurrentCell()Rangeचालू शीट में मौजूदा सेल लौटाता है या अगर कोई मौजूदा सेल नहीं है, तो null दिखाता है.
getDataRange()Rangeउस डाइमेंशन के हिसाब से Range दिखाता है जिसमें डेटा मौजूद होता है.
getDataSourceFormulas()DataSourceFormula[]डेटा सोर्स के सभी फ़ॉर्मूला की जानकारी मिलती है.
getDataSourcePivotTables()DataSourcePivotTable[]सभी डेटा सोर्स की पिवट टेबल लेता है.
getDataSourceRefreshSchedules()DataSourceRefreshSchedule[]इस स्प्रेडशीट के लिए रीफ़्रेश शेड्यूल पाएं.
getDataSourceSheets()DataSourceSheet[]स्प्रेडशीट में मौजूद सभी डेटा सोर्स शीट दिखाता है.
getDataSourceTables()DataSourceTable[]सभी डेटा सोर्स टेबल दिखाता है.
getDataSources()DataSource[]स्प्रेडशीट में सभी डेटा सोर्स दिखाता है.
getDeveloperMetadata()DeveloperMetadata[]टॉप-लेवल की स्प्रेडशीट से जुड़े डेवलपर मेटाडेटा की जानकारी मिलती है.
getEditors()User[]इस Spreadsheet के लिए संपादकों की सूची दी जाती है.
getFormUrl()Stringइस स्प्रेडशीट पर जवाब भेजने वाले फ़ॉर्म का यूआरएल दिखाता है. इसके अलावा, अगर इस स्प्रेडशीट से जुड़ा कोई फ़ॉर्म नहीं है, तो null दिखाता है.
getFrozenColumns()Integerफ़्रीज़ किए गए कॉलम की संख्या दिखाता है.
getFrozenRows()Integerफ़्रीज़ की गई पंक्तियों की संख्या दिखाता है.
getId()Stringइसे स्प्रेडशीट के लिए यूनीक आइडेंटिफ़ायर मिलता है.
getImages()OverGridImage[]शीट पर मौजूद, ग्रिड पर मौजूद सभी इमेज दिखाता है.
getIterativeCalculationConvergenceThreshold()Numberपुनरावृत्तीय गणना के दौरान इस्तेमाल की गई थ्रेशोल्ड वैल्यू दिखाता है.
getLastColumn()Integerकॉन्टेंट वाले आखिरी कॉलम की जगह दिखाता है.
getLastRow()Integerकॉन्टेंट वाली आखिरी पंक्ति की जगह दिखाता है.
getMaxIterativeCalculationCycles()Integerपुनरावृत्तीय गणना के दौरान उपयोग किए जाने वाले दोहरावों की अधिकतम संख्या देता है.
getName()Stringदस्तावेज़ का नाम दिखाता है.
getNamedRanges()NamedRange[]इस स्प्रेडशीट में, नाम वाली सभी रेंज दिखती हैं.
getNumSheets()Integerइस स्प्रेडशीट में शीट की संख्या दिखाता है.
getOwner()Userदस्तावेज़ के मालिक की जानकारी देता है या शेयर की गई ड्राइव में मौजूद किसी दस्तावेज़ के लिए null दिखाता है.
getPredefinedSpreadsheetThemes()SpreadsheetTheme[]पहले से तय थीम की सूची दिखाता है.
getProtections(type)Protection[]स्प्रेडशीट में सुरक्षित की गई सभी रेंज या शीट को दिखाने वाले ऑब्जेक्ट का कलेक्शन सेट करता है.
getRange(a1Notation)RangeA1 संकेतन या R1C1 संकेतन में बताई गई श्रेणी देता है.
getRangeByName(name)Rangeनाम वाली रेंज दिखाता है. अगर दिए गए नाम वाली कोई रेंज नहीं मिलती है, तो null दिखाता है.
getRangeList(a1Notations)RangeListA1 संकेतन या R1C1 संकेतनों की गैर-खाली सूची से तय की गई समान शीट में मौजूद रेंज को दिखाने वाला RangeList संग्रह देता है.
getRecalculationInterval()RecalculationIntervalइस स्प्रेडशीट के लिए कैलकुलेशन इंटरवल दिखाता है.
getRowHeight(rowPosition)Integerदी गई पंक्ति की पिक्सल में ऊंचाई दिखाता है.
getSelection()Selectionस्प्रेडशीट में मौजूदा Selection दिखाता है.
getSheetByName(name)Sheetदिए गए नाम वाली शीट दिखाता है.
getSheetId()Integerइस ऑब्जेक्ट से दिखाई गई शीट का आईडी दिखाता है.
getSheetName()Stringशीट का नाम दिखाता है.
getSheetValues(startRow, startColumn, numRows, numColumns)Object[][]दिए गए निर्देशांकों से शुरू करके, इस रेंज के लिए वैल्यू की आयताकार ग्रिड देता है.
getSheets()Sheet[]इस स्प्रेडशीट की सभी शीट दिखाता है.
getSpreadsheetLocale()Stringस्प्रेडशीट की स्थान-भाषा मिलती है.
getSpreadsheetTheme()SpreadsheetThemeस्प्रेडशीट की मौजूदा थीम दिखाता है. अगर कोई थीम लागू नहीं की गई है, तो null दिखाता है.
getSpreadsheetTimeZone()Stringस्प्रेडशीट के लिए टाइम ज़ोन की जानकारी मिलती है.
getUrl()Stringदी गई स्प्रेडशीट का यूआरएल दिखाता है.
getViewers()User[]इस Spreadsheet को देखने वाले दर्शकों और टिप्पणी करने वालों की सूची मिलती है.
hideColumn(column)voidदी गई रेंज में कॉलम या कॉलम छिपा देता है.
hideRow(row)voidदी गई रेंज में पंक्तियां छिपा देता है.
insertColumnAfter(afterPosition)Sheetदी गई कॉलम की स्थिति के बाद एक कॉलम डालता है.
insertColumnBefore(beforePosition)Sheetदी गई कॉलम की स्थिति से पहले कॉलम डालता है.
insertColumnsAfter(afterPosition, howMany)Sheetदिए गए कॉलम की स्थिति के बाद, कॉलम की दी गई संख्या को शामिल करता है.
insertColumnsBefore(beforePosition, howMany)Sheetदिए गए कॉलम की स्थिति से पहले कई कॉलम डालता है.
insertDataSourceSheet(spec)DataSourceSheetस्प्रेडशीट में नया DataSourceSheet सम्मिलित करता है और डेटा एक्ज़ीक्यूशन शुरू करता है.
insertImage(blobSource, column, row)OverGridImageकिसी पंक्ति और कॉलम में, दस्तावेज़ में Spreadsheet को इमेज के तौर पर डालता है.
insertImage(blobSource, column, row, offsetX, offsetY)OverGridImageपिक्सल ऑफ़सेट के साथ किसी दी गई पंक्ति और कॉलम में, दस्तावेज़ में Spreadsheet को इमेज के तौर पर डालता है.
insertImage(url, column, row)OverGridImageदस्तावेज़ में किसी पंक्ति और कॉलम में इमेज डालता है.
insertImage(url, column, row, offsetX, offsetY)OverGridImageपिक्सल ऑफ़सेट के साथ दी गई पंक्ति और कॉलम में दस्तावेज़ में इमेज डालता है.
insertRowAfter(afterPosition)Sheetदी गई पंक्ति की जगह के बाद पंक्ति शामिल करता है.
insertRowBefore(beforePosition)Sheetदी गई पंक्ति की जगह से पहले पंक्ति शामिल करता है.
insertRowsAfter(afterPosition, howMany)Sheetदी गई पंक्ति की जगह के बाद कई पंक्तियां शामिल करता है.
insertRowsBefore(beforePosition, howMany)Sheetदी गई पंक्ति की जगह से पहले कई पंक्तियां शामिल करता है.
insertSheet()Sheetडिफ़ॉल्ट शीट के नाम का इस्तेमाल करके, स्प्रेडशीट में एक नई शीट डालता है.
insertSheet(sheetIndex)Sheetदिए गए इंडेक्स पर स्प्रेडशीट में एक नई शीट शामिल करता है.
insertSheet(sheetIndex, options)Sheetदिए गए इंडेक्स की स्प्रेडशीट में नई शीट शामिल करता है और वैकल्पिक बेहतर तर्कों का इस्तेमाल करता है.
insertSheet(options)Sheetडिफ़ॉल्ट शीट के नाम और वैकल्पिक बेहतर तर्कों का इस्तेमाल करके, स्प्रेडशीट में नई शीट डालता है.
insertSheet(sheetName)Sheetस्प्रेडशीट में दिए गए नाम वाली नई शीट को शामिल करता है.
insertSheet(sheetName, sheetIndex)Sheetदिए गए इंडेक्स में दिए गए नाम के साथ स्प्रेडशीट में एक नई शीट डालता है.
insertSheet(sheetName, sheetIndex, options)Sheetदिए गए इंडेक्स में दिए गए नाम के साथ स्प्रेडशीट में एक नई शीट डालता है और वैकल्पिक बेहतर तर्कों का इस्तेमाल करता है.
insertSheet(sheetName, options)Sheetस्प्रेडशीट में दिए गए नाम वाली नई शीट शामिल करता है और वैकल्पिक बेहतर तर्कों का इस्तेमाल करता है.
insertSheetWithDataSourceTable(spec)Sheetस्प्रेडशीट में एक नई शीट शामिल करता है, दिए गए डेटा सोर्स की खास जानकारी के साथ पूरी शीट पर DataSourceTable बनाता है, और डेटा को एक जगह से दूसरी जगह भेजता है.
isColumnHiddenByUser(columnPosition)Booleanयह दिखाता है कि उपयोगकर्ता ने कॉलम छिपाया है या नहीं.
isIterativeCalculationEnabled()Booleanयह दिखाता है कि इस स्प्रेडशीट में बार-बार होने वाली कैलकुलेशन की सुविधा चालू है या नहीं.
isRowHiddenByFilter(rowPosition)Booleanयह दिखाता है कि दी गई पंक्ति किसी फ़िल्टर (फ़िल्टर व्यू नहीं) से छिपी हुई है या नहीं.
isRowHiddenByUser(rowPosition)Booleanयह दिखाता है कि उपयोगकर्ता ने दी गई पंक्ति को छिपाया है या नहीं.
moveActiveSheet(pos)voidसक्रिय शीट को शीट की सूची में दी गई स्थिति पर ले जाता है.
moveChartToObjectSheet(chart)Sheetएक नई SheetType.OBJECT शीट बनाता है और दिए गए चार्ट को उसमें ले जाता है.
refreshAllDataSources()voidयह काम करने वाले सभी डेटा सोर्स और उनसे लिंक किए गए डेटा सोर्स ऑब्जेक्ट को रीफ़्रेश करता है. साथ ही, अमान्य डेटा सोर्स ऑब्जेक्ट को छोड़ देता है.
removeEditor(emailAddress)SpreadsheetSpreadsheet के लिए एडिटर की सूची से, दिए गए उपयोगकर्ता को हटाता है.
removeEditor(user)SpreadsheetSpreadsheet के लिए एडिटर की सूची से, दिए गए उपयोगकर्ता को हटाता है.
removeMenu(name)voidउस मेन्यू को हटाता है जिसे addMenu(name, subMenus) ने जोड़ा था.
removeNamedRange(name)voidदिए गए नाम वाली नाम वाली रेंज को मिटाता है.
removeViewer(emailAddress)Spreadsheetऐसा करने से, Spreadsheet के लिए दर्शकों और टिप्पणी करने वालों की सूची से, दिए गए उपयोगकर्ता को हटा दिया जाता है.
removeViewer(user)Spreadsheetऐसा करने से, Spreadsheet के लिए दर्शकों और टिप्पणी करने वालों की सूची से, दिए गए उपयोगकर्ता को हटा दिया जाता है.
rename(newName)voidदस्तावेज़ का नाम बदलता है.
renameActiveSheet(newName)voidमौजूदा चालू शीट का नाम, दिए गए नए नाम के हिसाब से बदलता है.
resetSpreadsheetTheme()SpreadsheetThemeलागू की गई थीम हटाता है और स्प्रेडशीट पर डिफ़ॉल्ट थीम सेट करता है.
setActiveRange(range)Rangeतय की गई रेंज को चालू शीट में active range के तौर पर सेट करता है. साथ ही, रेंज में सबसे ऊपर बाईं ओर मौजूद सेल को current cell के तौर पर सेट करता है.
setActiveRangeList(rangeList)RangeListयह ऐक्टिव शीट में रेंज की सूची को active ranges के तौर पर सेट करता है.
setActiveSelection(range)Rangeइस शीट के लिए चुने जाने का सक्रिय क्षेत्र सेट करता है.
setActiveSelection(a1Notation)RangeA1 नोटेशन या R1C1 नोटेशन में बताए गए तरीके के हिसाब से, ऐक्टिव सिलेक्शन सेट करता है.
setActiveSheet(sheet)Sheetदी गई शीट को स्प्रेडशीट में सक्रिय शीट के रूप में सेट करता है.
setActiveSheet(sheet, restoreSelection)Sheetदी गई शीट को स्प्रेडशीट में चालू शीट के तौर पर सेट करता है. साथ ही, उस शीट में सबसे हाल के चुने गए आइटम को वापस लाने का विकल्प भी देता है.
setColumnWidth(columnPosition, width)Sheetदिए गए कॉलम की चौड़ाई को पिक्सल में सेट करता है.
setCurrentCell(cell)Rangeबताए गए सेल को current cell के तौर पर सेट करता है.
setFrozenColumns(columns)voidकॉलम की दी गई संख्या को फ़्रीज़ करता है.
setFrozenRows(rows)voidपंक्तियों की दी गई संख्या को फ़्रीज़ करता है.
setIterativeCalculationConvergenceThreshold(minThreshold)Spreadsheetपुनरावृत्तीय गणना के लिए कम से कम थ्रेशोल्ड मान सेट करता है.
setIterativeCalculationEnabled(isEnabled)Spreadsheetसेट करती है कि इस स्प्रेडशीट में बार-बार होने वाली कैलकुलेशन की सुविधा चालू है या नहीं.
setMaxIterativeCalculationCycles(maxIterations)Spreadsheetयह फ़ंक्शन, बार-बार दोहराए जाने वाले कैलकुलेशन के दौरान की जाने वाली, कैलकुलेशन की ज़्यादा से ज़्यादा संख्या सेट करता है.
setNamedRange(name, range)voidकिसी रेंज को नाम देता है.
setRecalculationInterval(recalculationInterval)Spreadsheetसेट करता है कि इस स्प्रेडशीट को कितनी बार फिर से कैलकुलेट करना चाहिए.
setRowHeight(rowPosition, height)Sheetकिसी पंक्ति की ऊंचाई को पिक्सल में सेट करता है.
setSpreadsheetLocale(locale)voidस्प्रेडशीट की स्थान-भाषा सेट करता है.
setSpreadsheetTheme(theme)SpreadsheetThemeस्प्रेडशीट पर थीम सेट करता है.
setSpreadsheetTimeZone(timezone)voidस्प्रेडशीट के लिए टाइम ज़ोन सेट करता है.
show(userInterface)voidउपयोगकर्ता के ब्राउज़र के व्यूपोर्ट में बीच में मौजूद डायलॉग बॉक्स में कस्टम यूज़र इंटरफ़ेस कॉम्पोनेंट दिखाता है.
sort(columnPosition)Sheetशीट को कॉलम के हिसाब से बढ़ते क्रम में लगाता है.
sort(columnPosition, ascending)Sheetशीट को कॉलम के हिसाब से क्रम में लगाता है.
toast(msg)voidदिए गए मैसेज वाली स्प्रेडशीट के नीचे दाएं कोने में एक पॉप-अप विंडो दिखाता है.
toast(msg, title)voidस्प्रेडशीट के नीचे दाएं कोने में, दिए गए मैसेज और टाइटल के साथ एक पॉप-अप विंडो दिखाता है.
toast(msg, title, timeoutSeconds)voidस्प्रेडशीट के नीचे दाएं कोने में, दिए गए शीर्षक और मैसेज के साथ एक पॉप-अप विंडो दिखाता है, जो तय समय तक दिखता रहता है.
unhideColumn(column)voidदी गई रेंज में कॉलम दिखाता है.
unhideRow(row)voidदी गई रेंज में पंक्ति दिखाता है.
updateMenu(name, subMenus)voidउस मेन्यू को अपडेट करता है जिसे addMenu(name, subMenus) ने जोड़ा है.
waitForAllDataExecutionsCompletion(timeoutInSeconds)voidस्प्रेडशीट में सभी मौजूदा बदलावों के पूरा होने का इंतज़ार करता है. यह प्रोसेस, तय किए गए सेकंड में ही खत्म हो जाती है.

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

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');

// Adds the key 'NAME' in the developer metadata for the spreadsheet.
ss.addDeveloperMetadata('NAME')

// Gets the first developer metadata object and logs its key.
const developerMetaData = ss.getDeveloperMetadata()[0]
console.log(developerMetaData.getKey())

पैरामीटर

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

रिटर्न

Spreadsheet — यह स्प्रेडशीट, चेन बनाने के लिए है.

अनुमति

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

  • 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');

// Adds the key 'NAME' in the developer metadata for the spreadsheet and sets the visibility
// to the developer project that created the metadata.
ss.addDeveloperMetadata('NAME', SpreadsheetApp.DeveloperMetadataVisibility.PROJECT);

// Gets the first developer metadata object and logs its key and visibility setting.
const developerMetaData = ss.getDeveloperMetadata()[0];
console.log(developerMetaData.getKey());
console.log(`Key: ${developerMetaData.getKey()},
.             Visibility: ${developerMetaData.getVisibility()}`);

पैरामीटर

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

रिटर्न

Spreadsheet — यह स्प्रेडशीट, चेन बनाने के लिए है.

अनुमति

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

  • 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');

// Adds the key 'NAME' and sets the value to 'GOOGLE' in the developer metadata for the
// spreadsheet.
ss.addDeveloperMetadata('NAME', 'GOOGLE');

// Gets the first developer metadata object and logs its key and value.
const developerMetaData = ss.getDeveloperMetadata()[0];
console.log(developerMetaData.getKey());
console.log(`Key: ${developerMetaData.getKey()}, Value: ${developerMetaData.getValue()}`);

पैरामीटर

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

रिटर्न

Spreadsheet — यह स्प्रेडशीट, चेन बनाने के लिए है.

अनुमति

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

  • 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');

// Adds the key 'NAME', sets the value to 'GOOGLE', and sets the visibility
// to any developer project with document access.
ss.addDeveloperMetadata('NAME', 'GOOGLE', SpreadsheetApp.DeveloperMetadataVisibility.DOCUMENT);

// Gets the first developer metadata object and logs its key, value, and visibility setting.
const developerMetaData = ss.getDeveloperMetadata()[0];
console.log(`Key: ${developerMetaData.getKey()},
             Value: ${developerMetaData.getValue()},
             Visibility: ${developerMetaData.getVisibility()}`);

पैरामीटर

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

रिटर्न

Spreadsheet — यह स्प्रेडशीट, चेन बनाने के लिए है.

अनुमति

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

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

addEditor(emailAddress)

दिए गए उपयोगकर्ता को Spreadsheet के लिए एडिटर की सूची में जोड़ता है. अगर उपयोगकर्ता पहले से ही दर्शकों की सूची में था, तो इस तरीके का इस्तेमाल करने से उसे दर्शकों की सूची से बाहर रखा जाता है.

पैरामीटर

नामटाइपब्यौरा
emailAddressStringजोड़ने के लिए उपयोगकर्ता का ईमेल पता.

रिटर्न

Spreadsheet — यह Spreadsheet, चेन बनाने के लिए है.

अनुमति

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

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

addEditor(user)

दिए गए उपयोगकर्ता को Spreadsheet के लिए एडिटर की सूची में जोड़ता है. अगर उपयोगकर्ता पहले से ही दर्शकों की सूची में था, तो इस तरीके का इस्तेमाल करने से उसे दर्शकों की सूची से बाहर रखा जाता है.

पैरामीटर

नामटाइपब्यौरा
userUserजोड़े जाने वाले उपयोगकर्ता का इलस्ट्रेशन.

रिटर्न

Spreadsheet — यह Spreadsheet, चेन बनाने के लिए है.

अनुमति

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

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

addEditors(emailAddresses)

उपयोगकर्ताओं के दिए गए अरे को Spreadsheet के लिए एडिटर की सूची में जोड़ता है. अगर कोई उपयोगकर्ता पहले से ही दर्शकों की सूची में मौजूद है, तो इस तरीके से उसे दर्शकों की सूची से बाहर रखा जाता है.

पैरामीटर

नामटाइपब्यौरा
emailAddressesString[]जोड़े जाने वाले उपयोगकर्ताओं के ईमेल पतों की कैटगरी.

रिटर्न

Spreadsheet — यह Spreadsheet, चेन बनाने के लिए है.

अनुमति

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

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

addMenu(name, subMenus)

स्प्रेडशीट यूज़र इंटरफ़ेस (यूआई) में एक नया मेन्यू बनाता है.

हर मेन्यू एंट्री, उपयोगकर्ता का तय किया गया फ़ंक्शन चलाती है. आम तौर पर, इसे onOpen() फ़ंक्शन से कॉल करना होता है, ताकि स्प्रेडशीट लोड होने पर मेन्यू अपने-आप बन जाए.

// The onOpen function is executed automatically every time a Spreadsheet is loaded
function onOpen() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var menuEntries = [];
  // When the user clicks on "addMenuExample" then "Menu Entry 1", the function function1 is
  // executed.
  menuEntries.push({name: "Menu Entry 1", functionName: "function1"});
  menuEntries.push(null); // line separator
  menuEntries.push({name: "Menu Entry 2", functionName: "function2"});

  ss.addMenu("addMenuExample", menuEntries);
}

पैरामीटर

नामटाइपब्यौरा
nameStringबनाए जाने वाले मेन्यू का नाम.
subMenusObject[]JavaScript मैप की कलेक्शन, जिसमें name और functionName पैरामीटर शामिल हैं. शामिल की गई लाइब्रेरी के फ़ंक्शन इस्तेमाल किए जा सकते हैं, जैसे कि Library.libFunction1.

अनुमति

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

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

addViewer(emailAddress)

दिए गए उपयोगकर्ता को Spreadsheet के दर्शकों की सूची में जोड़ता है. अगर उपयोगकर्ता पहले से एडिटर की सूची में था, तो इस तरीके का कोई असर नहीं होगा.

पैरामीटर

नामटाइपब्यौरा
emailAddressStringजोड़ने के लिए उपयोगकर्ता का ईमेल पता.

रिटर्न

Spreadsheet — यह Spreadsheet, चेन बनाने के लिए है.

अनुमति

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

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

addViewer(user)

दिए गए उपयोगकर्ता को Spreadsheet के दर्शकों की सूची में जोड़ता है. अगर उपयोगकर्ता पहले से एडिटर की सूची में था, तो इस तरीके का कोई असर नहीं होगा.

पैरामीटर

नामटाइपब्यौरा
userUserजोड़े जाने वाले उपयोगकर्ता का इलस्ट्रेशन.

रिटर्न

Spreadsheet — यह Spreadsheet, चेन बनाने के लिए है.

अनुमति

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

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

addViewers(emailAddresses)

Spreadsheet के लिए दर्शकों की सूची में उपयोगकर्ताओं के दिए गए अरे को जोड़ता है. अगर कोई उपयोगकर्ता पहले से संपादकों की सूची में था, तो इस तरीके का उस पर कोई असर नहीं होता.

पैरामीटर

नामटाइपब्यौरा
emailAddressesString[]जोड़े जाने वाले उपयोगकर्ताओं के ईमेल पतों की कैटगरी.

रिटर्न

Spreadsheet — यह Spreadsheet, चेन बनाने के लिए है.

अनुमति

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

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

appendRow(rowContents)

शीट में मौजूदा डेटा क्षेत्र में सबसे नीचे एक लाइन जोड़ता है. अगर किसी सेल का कॉन्टेंट = से शुरू होता है, तो उसे एक फ़ॉर्मूला माना जाता है.

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

// Appends a new row with 3 columns to the bottom of the current
// data region in the sheet containing the values in the array.
sheet.appendRow(["a man", "a plan", "panama"]);

पैरामीटर

नामटाइपब्यौरा
rowContentsObject[]शीट में आखिरी लाइन के बाद शामिल की जाने वाली वैल्यू का कलेक्शन.

रिटर्न

Sheet — यह शीट, मेथड चेन में काम की है.

अनुमति

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

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

autoResizeColumn(columnPosition)

दिए गए कॉलम की चौड़ाई को इसकी सामग्री के हिसाब से सेट करता है.

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

sheet.getRange('a1').setValue('Whenever it is a damp, drizzly November in my soul...');

// Sets the first column to a width which fits the text
sheet.autoResizeColumn(1);

पैरामीटर

नामटाइपब्यौरा
columnPositionIntegerआकार बदलने के लिए दिए गए कॉलम की स्थिति.

रिटर्न

Sheet — शीट, मेथड चेन में काम की है

अनुमति

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

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

copy(name)

स्प्रेडशीट को कॉपी करता है और नई स्प्रेडशीट दिखाता है.

// This code makes a copy of the current spreadsheet and names it appropriately
var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.copy("Copy of " + ss.getName());

पैरामीटर

नामटाइपब्यौरा
nameStringकॉपी का नाम.

रिटर्न

Spreadsheet — यह स्प्रेडशीट, चेन बनाने के लिए है.

अनुमति

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

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

createDeveloperMetadataFinder()

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

// 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');

// Adds developer metadata to the spreadsheet.
ss.addDeveloperMetadata('NAME', 'CHARLIE');
ss.addDeveloperMetadata('COMPANY', 'EXAMPLE ORGANIZATION');
ss.addDeveloperMetadata('TECHNOLOGY', 'JAVASCRIPT');

// Creates a developer metadata finder.
const developerMetadataFinder = ss.createDeveloperMetadataFinder();

// Finds the developer metadata objects with 'COMPANY' as the key.
const googleMetadataFromSpreadsheet = developerMetadataFinder.withKey('COMPANY').find();

// Gets the first result of developer metadata that has the key 'COMPANY' and logs its value.
console.log(googleMetadataFromSpreadsheet[0].getValue());

रिटर्न

DeveloperMetadataFinder — इस स्प्रेडशीट के दायरे में मौजूद मेटाडेटा खोजने के लिए, डेवलपर मेटाडेटा ढूंढने की सुविधा.


createTextFinder(findText)

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

var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();

// Creates  a text finder.
var textFinder = spreadsheet.createTextFinder('dog');

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

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

पैरामीटर

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

रिटर्न

TextFinder — स्प्रेडशीट के लिए TextFinder.


deleteActiveSheet()

इस ऐक्टिव शीट को मिटाता है.

// The code below deletes the currently active sheet and stores the new active sheet in a
// variable
var newSheet = SpreadsheetApp.getActiveSpreadsheet().deleteActiveSheet();

रिटर्न

Sheet — नई चालू शीट.

अनुमति

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

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

deleteColumn(columnPosition)

दिए गए कॉलम की जगह से कॉलम मिटाता है.

var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
// Columns start at "1" - this deletes the first column
sheet.deleteColumn(1);

पैरामीटर

नामटाइपब्यौरा
columnPositionIntegerकॉलम की जगह, पहले कॉलम के लिए 1 से शुरू.

रिटर्न

Sheet — शीट, मेथड चेन में काम की है

अनुमति

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

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

deleteColumns(columnPosition, howMany)

दिए गए कॉलम की जगह से शुरू होने वाले कई कॉलम मिटाता है.

var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
// Columns start at "1" - this deletes the first two columns
sheet.deleteColumns(1, 2);

पैरामीटर

नामटाइपब्यौरा
columnPositionIntegerमिटाए जाने वाले पहले कॉलम की जगह.
howManyIntegerमिटाए जाने वाले कॉलम की संख्या.

अनुमति

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

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

deleteRow(rowPosition)

दी गई पंक्ति की जगह से पंक्ति मिटाता है.

var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
// Rows start at "1" - this deletes the first row
sheet.deleteRow(1);

पैरामीटर

नामटाइपब्यौरा
rowPositionIntegerपहली पंक्ति के लिए 1 से शुरू करते हुए पंक्ति की स्थिति.

रिटर्न

Sheet — शीट, मेथड चेन में काम की है

अनुमति

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

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

deleteRows(rowPosition, howMany)

दी गई पंक्ति की जगह से शुरू होने वाली कई पंक्तियां मिटाता है.

var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
// Rows start at "1" - this deletes the first two rows
sheet.deleteRows(1, 2);

पैरामीटर

नामटाइपब्यौरा
rowPositionIntegerमिटाई जाने वाली पहली पंक्ति की जगह.
howManyIntegerमिटाई जाने वाली पंक्तियों की संख्या.

अनुमति

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

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

deleteSheet(sheet)

चुनी गई शीट को मिटाता है.

// The code below deletes the specified sheet.
var ss = SpreadsheetApp.getActive();
var sheet = ss.getSheetByName('My Sheet');
ss.deleteSheet(sheet);

पैरामीटर

नामटाइपब्यौरा
sheetSheetवह शीट जिसे आपको मिटाना है.

अनुमति

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

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

duplicateActiveSheet()

चालू शीट की डुप्लीकेट कॉपी बनाकर, उसे ऐक्टिव शीट में बदल देता है.

// The code below makes a duplicate of the active sheet
SpreadsheetApp.getActiveSpreadsheet().duplicateActiveSheet();

रिटर्न

Sheet — नई शीट.

अनुमति

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

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

getActiveCell()

इस शीट में ऐक्टिव सेल की जानकारी देता है.

ध्यान दें: getCurrentCell() का इस्तेमाल करना बेहतर होता है, जो हाइलाइट किया गया मौजूदा सेल दिखाता है.

var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
// Returns the active cell
var cell = sheet.getActiveCell();

रिटर्न

Range — मौजूदा सक्रिय सेल

अनुमति

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

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

getActiveRange()

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

"सक्रिय रेंज" शब्द का मतलब उस रेंज से है जिसे उपयोगकर्ता ने सक्रिय शीट में चुना है. लेकिन कस्टम फ़ंक्शन में यह उस सेल को दिखाता है जिसका सक्रिय तौर पर फिर से हिसाब लगाया जा रहा है.

var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var activeRange = sheet.getActiveRange();

रिटर्न

Range — सक्रिय रेंज

अनुमति

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

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

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


getActiveRangeList()

कोई सक्रिय रेंज नहीं होने पर, सक्रिय शीट में सक्रिय रेंज की सूची दिखाता है या null.

अगर सिर्फ़ एक रेंज चुनी जाती है, तो यह getActiveRange() कॉल की तरह काम करता है.

var sheet = SpreadsheetApp.getActiveSheet();
// Returns the list of active ranges.
var activeRangeList = sheet.getActiveRangeList();

रिटर्न

RangeList — चालू रेंज की सूची

अनुमति

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

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

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


getActiveSheet()

ऐक्टिव शीट को स्प्रेडशीट में दिखाता है.

स्प्रेडशीट में चालू शीट वह शीट होती है जो स्प्रेडशीट यूज़र इंटरफ़ेस (यूआई) में दिख रही है.

var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();

रिटर्न

Sheet — स्प्रेडशीट में मौजूद ऐक्टिव शीट.


getAs(contentType)

इस ऑब्जेक्ट के अंदर डेटा को, बताए गए कॉन्टेंट टाइप में बदले गए ब्लॉब के तौर पर दिखाएं. इस तरीका से फ़ाइल नाम में सही एक्सटेंशन जोड़ा जा सकता है—उदाहरण के लिए, "myfile.pdf". हालांकि, यह माना जाता है कि फ़ाइल नाम का वह हिस्सा जो पिछली अवधि (अगर कोई है) के बाद आता है, तो वह मौजूदा एक्सटेंशन है जिसे बदला जाना चाहिए. इस वजह से, "ShoppingList.12.25.2014", "ShoppingList.12.25.pdf" हो जाता है.

कन्वर्ज़न के रोज़ के कोटा देखने के लिए, Google Services के लिए कोटा देखें. हाल ही में बनाए गए Google Workspace डोमेन पर, कुछ समय के लिए सख्त कोटे लागू हो सकते हैं.

पैरामीटर

नामटाइपब्यौरा
contentTypeStringवह MIME टाइप जिसमें बदलना है. ज़्यादातर ब्लॉब के लिए, सिर्फ़ 'application/pdf' ही मान्य विकल्प है. BMP, GIF, JPEG या PNG फ़ॉर्मैट में मौजूद इमेज के लिए, 'image/bmp', 'image/gif', 'image/jpeg' या 'image/png' में से कोई भी मान्य है.

रिटर्न

Blob — ब्लॉब के तौर पर डेटा.


getBandings()

इस स्प्रेडशीट की सभी बैंडिंग देता है.

// Opens the spreadsheet file 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 an array of the bandings in the spreadsheet.
const bandings = ss.getBandings();

// Logs the range of the first banding in the spreadsheet to the console.
console.log(bandings[0].getRange().getA1Notation());

रिटर्न

Banding[] — इस स्प्रेडशीट में मौजूद बैंडिंग.

अनुमति

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

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

getBlob()

इस ऑब्जेक्ट के अंदर का डेटा, ब्लॉब के तौर पर दें.

रिटर्न

Blob — ब्लॉब के तौर पर डेटा.


getColumnWidth(columnPosition)

दिए गए कॉलम की चौड़ाई को पिक्सल में दिखाता है.

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

// Columns start at 1
Logger.log(sheet.getColumnWidth(1));

पैरामीटर

नामटाइपब्यौरा
columnPositionIntegerजांच किए जाने वाले कॉलम की जगह.

रिटर्न

Integer — कॉलम की चौड़ाई पिक्सल में

अनुमति

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

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

getCurrentCell()

चालू शीट में मौजूदा सेल लौटाता है या अगर कोई मौजूदा सेल नहीं है, तो null दिखाता है. मौजूदा सेल वह सेल है जिसका फ़ोकस Google Sheets के यूज़र इंटरफ़ेस (यूआई) में है और उसे गहरे रंग के बॉर्डर से हाइलाइट किया जाता है. इसमें कभी भी एक से ज़्यादा सेल नहीं होती हैं. जब कोई उपयोगकर्ता एक या ज़्यादा सेल रेंज चुनता है, तो चुने गए सेल में से एक सेल मौजूदा सेल होती है.

var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
// Returns the current highlighted cell in the one of the active ranges.
var currentCell = sheet.getCurrentCell();

रिटर्न

Range — मौजूदा सेल

अनुमति

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

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

getDataRange()

उस डाइमेंशन के हिसाब से Range दिखाता है जिसमें डेटा मौजूद होता है.

यह फ़ंक्शनल तौर पर, A1 और (Sheet.getLastColumn(), Sheets.getLastRow()) से बंधी हुई रेंज बनाने के बराबर है.

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

// This represents ALL the data
var range = sheet.getDataRange();
var values = range.getValues();

// This logs the spreadsheet in CSV format with a trailing comma
for (var i = 0; i < values.length; i++) {
  var row = "";
  for (var j = 0; j < values[i].length; j++) {
    if (values[i][j]) {
      row = row + values[i][j];
    }
    row = row + ",";
  }
  Logger.log(row);
}

रिटर्न

Range — स्प्रेडशीट में मौजूद सभी डेटा की रेंज

अनुमति

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

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

getDataSourceFormulas()

डेटा सोर्स के सभी फ़ॉर्मूला की जानकारी मिलती है.

// Opens the spreadsheet by its ID. If you created your script from within 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 an array of the data source formulas on Sheet1.
// To get an array of data source formulas for the entire spreadsheet,
// replace 'sheet' with 'ss'.
const dataSourceFormulas = sheet.getDataSourceFormulas();

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

रिटर्न

DataSourceFormula[] — डेटा सोर्स के फ़ॉर्मूले की सूची.

अनुमति

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

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

getDataSourcePivotTables()

सभी डेटा सोर्स की पिवट टेबल लेता है.

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

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

// Gets an array of the data source pivot tables on Sheet1.
// To get an array of data source pivot tables for the entire
// spreadsheet, replace 'sheet' with 'ss'.
const dataSourcePivotTables = sheet.getDataSourcePivotTables();

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

रिटर्न

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

अनुमति

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

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

getDataSourceRefreshSchedules()

इस स्प्रेडशीट के लिए रीफ़्रेश शेड्यूल पाएं.

// 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');

// Activates BigQuery operations for the connected spreadsheet.
SpreadsheetApp.enableBigQueryExecution();

// Gets the frequency type of the first referesh schedule in the array.
const frequencyType = ss.getDataSourceRefreshSchedules()[0]
                        .getFrequency()
                        .getFrequencyType()
                        .toString();

// Logs the frequency type to the console.
console.log(frequencyType);

रिटर्न

DataSourceRefreshSchedule[] — इस स्प्रेडशीट के रीफ़्रेश शेड्यूल.

अनुमति

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

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

getDataSourceSheets()

स्प्रेडशीट में मौजूद सभी डेटा सोर्स शीट दिखाता है.

// Turns data execution on for BigQuery data sources.
SpreadsheetApp.enableBigQueryExecution();

// Opens the spreadsheet file 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 the first data source sheet in the spreadsheet.
const dataSource = ss.getDataSourceSheets()[0];

// Gets the name of the data source sheet.
console.log(dataSource.asSheet().getName());

रिटर्न

DataSourceSheet[] — सभी डेटा सोर्स शीट का कलेक्शन.

अनुमति

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

  • 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 an array of data source tables on Sheet1.
// To get an array of data source tables for the entire spreadsheet,
// replace 'sheet' with 'ss'.
const dataSourceTables = sheet.getDataSourceTables();

// Logs the last completed data execution time on the first data source table.
console.log(dataSourceTables[0].getStatus().getLastExecutionTime());

रिटर्न

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

अनुमति

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

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

getDataSources()

स्प्रेडशीट में सभी डेटा सोर्स दिखाता है.

// Turns data execution on for BigQuery data sources.
SpreadsheetApp.enableBigQueryExecution();

// Opens the spreadsheet file 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 the data sources on the spreadsheet.
const dataSources = ss.getDataSources();

// Logs the name of the first column on the first data source.
console.log(dataSources[0].getColumns()[0].getName());

रिटर्न

DataSource[] — सभी डेटा सोर्स का कलेक्शन.

अनुमति

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

  • 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 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');

// Adds 'Google' as a key to the spreadsheet metadata.
ss.addDeveloperMetadata('Google');

// Gets the spreadsheet's metadata.
const ssMetadata = ss.getDeveloperMetadata();

// Gets the first set of the spreadsheet's metadata and logs the key to the console.
console.log(ssMetadata[0].getKey());

रिटर्न

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

अनुमति

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

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

getEditors()

इस Spreadsheet के लिए संपादकों की सूची दी जाती है.

रिटर्न

User[] — ऐसे उपयोगकर्ताओं की कैटगरी जिनके पास बदलाव करने की अनुमति है.

अनुमति

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

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

getFormUrl()

इस स्प्रेडशीट पर जवाब भेजने वाले फ़ॉर्म का यूआरएल दिखाता है. इसके अलावा, अगर इस स्प्रेडशीट से जुड़ा कोई फ़ॉर्म नहीं है, तो null दिखाता है. अगर एक से ज़्यादा फ़ॉर्म इस स्प्रेडशीट पर जवाब भेजते हैं, तो फ़ॉर्म का यूआरएल तय नहीं होता. विकल्प के तौर पर, हर शीट फ़ॉर्म यूआरएल असोसिएशन को Sheet.getFormUrl() तरीके से फिर से पाया जा सकता है.

// Opens the spreadsheet file 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 the form URL from the spreadsheet.
const formUrl = ss.getFormUrl();

// Logs the form URL to the console.
console.log(formUrl);

रिटर्न

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

अनुमति

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

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

getFrozenColumns()

फ़्रीज़ किए गए कॉलम की संख्या दिखाता है.

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

Logger.log("Number of frozen columns: %s", sheet.getFrozenColumns());

रिटर्न

Integer — फ़्रीज़ किए गए कॉलम की संख्या

अनुमति

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

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

getFrozenRows()

फ़्रीज़ की गई पंक्तियों की संख्या दिखाता है.

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

Logger.log("Number of frozen rows: %s", sheet.getFrozenRows());

रिटर्न

Integer — फ़्रीज़ की गई पंक्तियों की संख्या

अनुमति

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

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

getId()

इसे स्प्रेडशीट के लिए यूनीक आइडेंटिफ़ायर मिलता है. स्प्रेडशीट आईडी को उसके यूआरएल से लिया जा सकता है. उदाहरण के लिए, यूआरएल में स्प्रेडशीट आईडी https://docs.google.com/स्प्रेडशीटs/d/abc1234567/edit#gid=0 है, "abc1234567" है.

// The code below logs the ID for the active spreadsheet.
Logger.log(SpreadsheetApp.getActiveSpreadsheet().getId());

रिटर्न

String — स्प्रेडशीट का यूनीक आईडी (या कुंजी).


getImages()

शीट पर मौजूद, ग्रिड पर मौजूद सभी इमेज दिखाता है.

// Opens the spreadsheet file 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 over-the-grid images from Sheet1.
// To get the over-the-grid images from the entire spreadsheet, use ss.getImages() instead.
const images = sheet.getImages();

// For each image, logs the anchor cell in A1 notation.
for (const image of images) {
 console.log(image.getAnchorCell().getA1Notation());
}

रिटर्न

OverGridImage[] — ग्रिड में मौजूद इमेज का कलेक्शन.

अनुमति

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

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

getIterativeCalculationConvergenceThreshold()

पुनरावृत्तीय गणना के दौरान इस्तेमाल की गई थ्रेशोल्ड वैल्यू दिखाता है. जब क्रमिक गणना के नतीजों में इस वैल्यू से कम अंतर होता है, तो बार-बार होने वाली कैलकुलेशन रुक जाती है.

// Opens the spreadsheet file 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');

// Sets the iterative calculation convergence threshold for the spreadsheet.
ss.setIterativeCalculationConvergenceThreshold(2);

// Logs the threshold to the console.
console.log(ss.getIterativeCalculationConvergenceThreshold());

रिटर्न

Number — कन्वर्ज़न थ्रेशोल्ड.

अनुमति

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

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

getLastColumn()

कॉन्टेंट वाले आखिरी कॉलम की जगह दिखाता है.

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

// This logs the value in the very last cell of this sheet
var lastRow = sheet.getLastRow();
var lastColumn = sheet.getLastColumn();
var lastCell = sheet.getRange(lastRow, lastColumn);
Logger.log(lastCell.getValue());

रिटर्न

Integer — कॉन्टेंट वाली शीट का आखिरी कॉलम

अनुमति

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

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

getLastRow()

कॉन्टेंट वाली आखिरी पंक्ति की जगह दिखाता है.

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

// This logs the value in the very last cell of this sheet
var lastRow = sheet.getLastRow();
var lastColumn = sheet.getLastColumn();
var lastCell = sheet.getRange(lastRow, lastColumn);
Logger.log(lastCell.getValue());

रिटर्न

Integer — कॉन्टेंट वाली शीट की आखिरी लाइन

अनुमति

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

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

getMaxIterativeCalculationCycles()

पुनरावृत्तीय गणना के दौरान उपयोग किए जाने वाले दोहरावों की अधिकतम संख्या देता है.

// Opens the spreadsheet file 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');

// Sets the max iterative calculation cycles for the spreadsheet.
ss.setMaxIterativeCalculationCycles(10);

// Logs the max iterative calculation cycles to the console.
console.log(ss.getMaxIterativeCalculationCycles());

रिटर्न

Integer — बार-बार इस्तेमाल की जाने वाली गिनती की ज़्यादा से ज़्यादा संख्या.

अनुमति

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

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

getName()

दस्तावेज़ का नाम दिखाता है.

var ss = SpreadsheetApp.getActiveSpreadsheet();
Logger.log(ss.getName());

रिटर्न

String — स्प्रेडशीट का नाम.

अनुमति

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

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

getNamedRanges()

इस स्प्रेडशीट में, नाम वाली सभी रेंज दिखती हैं.

// The code below logs the name of the first named range.
var namedRanges = SpreadsheetApp.getActiveSpreadsheet().getNamedRanges();
for (var i = 0; i < namedRanges.length; i++) {
  Logger.log(namedRanges[i].getName());
}

रिटर्न

NamedRange[] — स्प्रेडशीट में नाम वाली सभी रेंज का कलेक्शन.

अनुमति

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

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

getNumSheets()

इस स्प्रेडशीट में शीट की संख्या दिखाता है.

// The code below logs the number of sheets in the active spreadsheet.
Logger.log(SpreadsheetApp.getActiveSpreadsheet().getNumSheets());

रिटर्न

Integer — स्प्रेडशीट में शीट की संख्या.


getOwner()

दस्तावेज़ के मालिक की जानकारी देता है या शेयर की गई ड्राइव में मौजूद किसी दस्तावेज़ के लिए null दिखाता है.

var ss = SpreadsheetApp.getActiveSpreadsheet();
var owner = ss.getOwner();
Logger.log(owner.getEmail());

रिटर्न

User — दस्तावेज़ का मालिक या अगर दस्तावेज़ 'शेयर की गई ड्राइव' में है, तो null.

अनुमति

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

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

getPredefinedSpreadsheetThemes()

पहले से तय थीम की सूची दिखाता है.

// The code below returns the list of predefined themes.
var predefinedThemesList = SpreadsheetApp.getActiveSpreadsheet()
                               .getPredefinedSpreadsheetThemes();

रिटर्न

SpreadsheetTheme[] — पहले से तय थीम की सूची.

अनुमति

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

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

getProtections(type)

स्प्रेडशीट में सुरक्षित की गई सभी रेंज या शीट को दिखाने वाले ऑब्जेक्ट का कलेक्शन सेट करता है.

// Remove all range protections in the spreadsheet that the user has permission to edit.
var ss = SpreadsheetApp.getActive();
var protections = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE);
for (var i = 0; i < protections.length; i++) {
  var protection = protections[i];
  if (protection.canEdit()) {
    protection.remove();
  }
}
// Remove all sheet protections in the spreadsheet that the user has permission to edit.
var ss = SpreadsheetApp.getActive();
var protections = ss.getProtections(SpreadsheetApp.ProtectionType.SHEET);
for (var i = 0; i < protections.length; i++) {
  var protection = protections[i];
  if (protection.canEdit()) {
    protection.remove();
  }
}

पैरामीटर

नामटाइपब्यौरा
typeProtectionTypeसंरक्षित क्षेत्र का टाइप, SpreadsheetApp.ProtectionType.RANGE या SpreadsheetApp.ProtectionType.SHEET.

रिटर्न

Protection[] — ऑब्जेक्ट का कलेक्शन, जो स्प्रेडशीट में सुरक्षित की गई सभी रेंज या शीट को दिखाता है.

अनुमति

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

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

getRange(a1Notation)

A1 संकेतन या R1C1 संकेतन में बताई गई श्रेणी देता है.

// Get a range A1:D4 on sheet titled "Invoices"
var ss = SpreadsheetApp.getActiveSpreadsheet();
var range = ss.getRange("Invoices!A1:D4");

// Get cell A1 on the first sheet
var sheet = ss.getSheets()[0];
var cell = sheet.getRange("A1");

पैरामीटर

नामटाइपब्यौरा
a1NotationStringदी जाने वाली श्रेणी, जैसा कि A1 संकेतन या R1C1 संकेतन में बताया गया है.

रिटर्न

Range — तय की गई जगह के लिए रेंज

अनुमति

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

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

getRangeByName(name)

नाम वाली रेंज दिखाता है. अगर दिए गए नाम वाली कोई रेंज नहीं मिलती है, तो null दिखाता है. अगर स्प्रेडशीट की एक से ज़्यादा शीट में एक ही रेंज के नाम का इस्तेमाल किया जाता है, तो शीट का नाम अलग से बताएं. उदाहरण के लिए, getRangeByName('TaxRates') या getRangeByName('Sheet Name!TaxRates'), लेकिन getRangeByName('"Sheet Name"!TaxRates') नहीं.

// Log the number of columns for the range named 'TaxRates' in the active spreadsheet.
var range = SpreadsheetApp.getActiveSpreadsheet().getRangeByName('TaxRates');
if (range != null) {
  Logger.log(range.getNumColumns());
}

पैरामीटर

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

रिटर्न

Range — दिए गए नाम वाले सेल की रेंज.


getRangeList(a1Notations)

A1 संकेतन या R1C1 संकेतनों की गैर-खाली सूची से तय की गई समान शीट में मौजूद रेंज को दिखाने वाला RangeList संग्रह देता है.

// Get a list of ranges A1:D4, F1:H4.
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var rangeList  = sheet.getRangeList(['A1:D4', 'F1:H4']);

पैरामीटर

नामटाइपब्यौरा
a1NotationsString[]A1 संकेतन या R1C1 संकेतन के मुताबिक दिखाई जाने वाली रेंज की सूची.

रिटर्न

RangeList — तय की गई जगह के लिए रेंज की सूची

अनुमति

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

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

getRecalculationInterval()

इस स्प्रेडशीट के लिए कैलकुलेशन इंटरवल दिखाता है.

// Opens the spreadsheet file 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');

// Logs the calculation interval for the spreadsheet to the console.
console.log(ss.getRecalculationInterval().toString());

रिटर्न

RecalculationInterval — इस स्प्रेडशीट के लिए कैलकुलेशन इंटरवल.

अनुमति

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

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

getRowHeight(rowPosition)

दी गई पंक्ति की पिक्सल में ऊंचाई दिखाता है.

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

// Rows start at 1
Logger.log(sheet.getRowHeight(1));

पैरामीटर

नामटाइपब्यौरा
rowPositionIntegerजांच करने के लिए पंक्ति की जगह.

रिटर्न

Integer — पंक्ति की ऊंचाई पिक्सल में

अनुमति

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

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

getSelection()

स्प्रेडशीट में मौजूदा Selection दिखाता है.

var selection = SpreadsheetApp.getActiveSpreadsheet().getSelection();
var currentCell = selection.getCurrentCell();

रिटर्न

Selection — चुनी गई मौजूदा तारीख

अनुमति

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

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

getSheetByName(name)

दिए गए नाम वाली शीट दिखाता है.

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

// The code below logs the index of a sheet named "Expenses"
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Expenses");
if (sheet != null) {
  Logger.log(sheet.getIndex());
}

पैरामीटर

नामटाइपब्यौरा
nameStringपाने के लिए शीट का नाम.

रिटर्न

Sheet — दिए गए नाम वाली शीट.


getSheetId()

इस ऑब्जेक्ट से दिखाई गई शीट का आईडी दिखाता है.

यह उस शीट का आईडी है जो स्प्रेडशीट के लिए यूनीक है. यह आईडी, शीट बनाने के समय असाइन किया गया एक ऐसा पूर्णांक होता है जो एक साथ बढ़ते हुए क्रम में होता है. यह शीट की जगह पर निर्भर नहीं करता. यह Range.copyFormatToRange(gridId, column, columnEnd, row, rowEnd) जैसे तरीकों के साथ काम का है, जो Sheet इंस्टेंस के बजाय gridId पैरामीटर लेता है.

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

Logger.log(sheet.getSheetId());

रिटर्न

Integer — स्प्रेडशीट के लिए खास शीट का आईडी

अनुमति

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

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

getSheetName()

शीट का नाम दिखाता है.

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

Logger.log(sheet.getSheetName());

रिटर्न

String — शीट का नाम

अनुमति

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

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

getSheetValues(startRow, startColumn, numRows, numColumns)

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

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

// The two samples below produce the same output
var values = sheet.getSheetValues(1, 1, 3, 3);
Logger.log(values);

var range = sheet.getRange(1, 1, 3, 3);
values = range.getValues();
Logger.log(values);

पैरामीटर

नामटाइपब्यौरा
startRowIntegerशुरुआती पंक्ति की जगह.
startColumnIntegerशुरुआती कॉलम की जगह.
numRowsIntegerपंक्तियों की वह संख्या जिनके लिए वैल्यू दी जानी है.
numColumnsIntegerकॉलम की संख्या जिनके लिए मान देना है.

रिटर्न

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

अनुमति

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

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

getSheets()

इस स्प्रेडशीट की सभी शीट दिखाता है.

// The code below logs the name of the second sheet
var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
if (sheets.length > 1) {
  Logger.log(sheets[1].getName());
}

रिटर्न

Sheet[] — स्प्रेडशीट में मौजूद सभी शीट का कलेक्शन.


getSpreadsheetLocale()

स्प्रेडशीट की स्थान-भाषा मिलती है.

// Opens the spreadsheet file 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 the spreadsheet locale.
const ssLocale = ss.getSpreadsheetLocale();

// Logs the locale to the console.
console.log(ssLocale);

रिटर्न

String — स्प्रेडशीट की स्थान-भाषा.

अनुमति

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

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

getSpreadsheetTheme()

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

// The code below returns the current theme of the spreadsheet.
var currentTheme = SpreadsheetApp.getActiveSpreadsheet().getSpreadsheetTheme();

रिटर्न

SpreadsheetTheme — लागू की गई मौजूदा थीम.

अनुमति

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

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

getSpreadsheetTimeZone()

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

// Opens the spreadsheet file 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');

// Sets the time zone of the spreadsheet.
ss.setSpreadsheetTimeZone('America/New_York');

// Gets the time zone of the spreadsheet.
const ssTimeZone = ss.getSpreadsheetTimeZone();

// Logs the time zone to the console.
console.log(ssTimeZone);

रिटर्न

String — टाइम ज़ोन, जिसे "लंबा" फ़ॉर्मैट में दिखाया जाता है (उदाहरण के लिए, "America/New_York", जैसा कि Joda.org) में बताया गया है.

अनुमति

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

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

getUrl()

दी गई स्प्रेडशीट का यूआरएल दिखाता है.

var ss = SpreadsheetApp.getActiveSpreadsheet();
Logger.log(ss.getUrl());

रिटर्न

String — दी गई स्प्रेडशीट का यूआरएल.

अनुमति

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

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

getViewers()

इस Spreadsheet को देखने वाले दर्शकों और टिप्पणी करने वालों की सूची मिलती है.

रिटर्न

User[] — ऐसे लोगों का कलेक्शन जिनके पास टिप्पणी देखने या टिप्पणी करने की अनुमति है.

अनुमति

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

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

hideColumn(column)

दी गई रेंज में कॉलम या कॉलम छिपा देता है.

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

// This hides the first column
let range = sheet.getRange("A1");
sheet.hideColumn(range);

// This hides the first 3 columns
let range = sheet.getRange("A:C");
sheet.hideColumn(range);

पैरामीटर

नामटाइपब्यौरा
columnRangeवह कॉलम रेंज जिसे छिपाना है.

अनुमति

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

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

hideRow(row)

दी गई रेंज में पंक्तियां छिपा देता है.

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

// This hides the first row
var range = sheet.getRange("A1");
sheet.hideRow(range);

पैरामीटर

नामटाइपब्यौरा
rowRangeपंक्ति की वह रेंज जिसे छिपाना है.

अनुमति

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

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

insertColumnAfter(afterPosition)

दी गई कॉलम की स्थिति के बाद एक कॉलम डालता है.

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

// This inserts a column after the first column position
sheet.insertColumnAfter(1);

पैरामीटर

नामटाइपब्यौरा
afterPositionIntegerवह कॉलम जिसके बाद नया कॉलम जोड़ना है.

रिटर्न

Sheet — शीट, मेथड चेन में काम की है

अनुमति

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

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

insertColumnBefore(beforePosition)

दी गई कॉलम की स्थिति से पहले कॉलम डालता है.

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

// This inserts a column in the first column position
sheet.insertColumnBefore(1);

पैरामीटर

नामटाइपब्यौरा
beforePositionIntegerवह कॉलम जिससे पहले नया कॉलम जोड़ना है.

रिटर्न

Sheet — शीट, मेथड चेन में काम की है

अनुमति

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

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

insertColumnsAfter(afterPosition, howMany)

दिए गए कॉलम की स्थिति के बाद, कॉलम की दी गई संख्या को शामिल करता है.

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

// Inserts two columns after the first column on the first sheet of the spreadsheet.
sheet.insertColumnsAfter(1,2);

पैरामीटर

नामटाइपब्यौरा
afterPositionIntegerवह कॉलम जिसके बाद नया कॉलम जोड़ना है.
howManyIntegerशामिल किए जाने वाले कॉलम की संख्या.

रिटर्न

Sheet — शीट, मेथड चेन में काम की है

अनुमति

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

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

insertColumnsBefore(beforePosition, howMany)

दिए गए कॉलम की स्थिति से पहले कई कॉलम डालता है.

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

// This inserts five columns before the first column
sheet.insertColumnsBefore(1, 5);

पैरामीटर

नामटाइपब्यौरा
beforePositionIntegerवह कॉलम जिससे पहले नया कॉलम जोड़ना है.
howManyIntegerशामिल किए जाने वाले कॉलम की संख्या.

रिटर्न

Sheet — शीट, मेथड चेन में काम की है

अनुमति

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

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

insertDataSourceSheet(spec)

स्प्रेडशीट में नया DataSourceSheet सम्मिलित करता है और डेटा एक्ज़ीक्यूशन शुरू करता है. साइड इफ़ेक्ट के तौर पर, इससे नई शीट भी सक्रिय शीट बन जाती है.

अगर डेटा सोर्स का टाइप चालू नहीं है, तो यह एक अपवाद है. किसी खास तरह के डेटा सोर्स का डेटा एक्ज़ीक्यूशन करने के लिए, SpreadsheetApp#enable...Execution() तरीके का इस्तेमाल करें.

// Activates BigQuery operations.
SpreadsheetApp.enableBigQueryExecution();

// 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');

// Builds a data source specification.
// TODO (developer): Update the project ID to your own Google Cloud project ID.
const dataSourceSpec = SpreadsheetApp.newDataSourceSpec()
 .asBigQuery()
 .setProjectId('project-id-1')
 .setTableProjectId('bigquery-public-data')
 .setDatasetId('ncaa_basketball')
 .setTableId('mbb_historical_teams_games')
 .build();

// Adds the data source and its data to the spreadsheet.
ss.insertDataSourceSheet(dataSourceSpec);

पैरामीटर

नामटाइपब्यौरा
specDataSourceSpecउस डेटा सोर्स की खास बातें जिसे शामिल करना है.

रिटर्न

DataSourceSheet — नई डेटा सोर्स शीट.

अनुमति

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

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

insertImage(blobSource, column, row)

किसी पंक्ति और कॉलम में, दस्तावेज़ में Spreadsheet को इमेज के तौर पर डालता है. इमेज का साइज़, ब्लॉब कॉन्टेंट से लिया जाता है. ब्लॉब का साइज़ ज़्यादा से ज़्यादा 2 एमबी हो सकता है.

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

var blob = Utilities.newBlob(binaryData, 'image/png', 'MyImageName');
sheet.insertImage(blob, 1, 1);

पैरामीटर

नामटाइपब्यौरा
blobSourceBlobSourceवह ब्लॉब जिसमें इमेज का कॉन्टेंट, MIME टाइप, और (वैकल्पिक तौर पर) नाम होता है.
columnIntegerकॉलम की स्थिति.
rowIntegerपंक्ति की जगह.

रिटर्न

OverGridImage — शामिल की गई इमेज.

अनुमति

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

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

insertImage(blobSource, column, row, offsetX, offsetY)

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

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

var blob = Utilities.newBlob(binaryData, 'image/png', 'MyImageName');
sheet.insertImage(blob, 1, 1, 10, 10);

पैरामीटर

नामटाइपब्यौरा
blobSourceBlobSourceवह ब्लॉब जिसमें इमेज का कॉन्टेंट, MIME टाइप, और (वैकल्पिक तौर पर) नाम होता है.
columnIntegerकॉलम की स्थिति.
rowIntegerपंक्ति की जगह.
offsetXIntegerपिक्सल में सेल के कोने से हॉरिज़ॉन्टल ऑफ़सेट.
offsetYIntegerपिक्सल में सेल के कोने से वर्टिकल ऑफ़सेट.

रिटर्न

OverGridImage — शामिल की गई इमेज.

अनुमति

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

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

insertImage(url, column, row)

दस्तावेज़ में किसी पंक्ति और कॉलम में इमेज डालता है.

दिया गया यूआरएल सार्वजनिक तौर पर उपलब्ध होना चाहिए.

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

sheet.insertImage("https://www.google.com/images/srpr/logo3w.png", 1, 1);

पैरामीटर

नामटाइपब्यौरा
urlStringइमेज का यूआरएल.
columnIntegerग्रिड कॉलम की जगह.
rowIntegerग्रिड की पंक्ति की जगह.

रिटर्न

OverGridImage — शामिल की गई इमेज.

अनुमति

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

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

insertImage(url, column, row, offsetX, offsetY)

पिक्सल ऑफ़सेट के साथ दी गई पंक्ति और कॉलम में दस्तावेज़ में इमेज डालता है.

दिया गया यूआरएल सार्वजनिक तौर पर उपलब्ध होना चाहिए.

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

sheet.insertImage("https://www.google.com/images/srpr/logo3w.png", 1, 1, 10, 10);

पैरामीटर

नामटाइपब्यौरा
urlStringइमेज के लिए यूआरएल.
columnIntegerकॉलम की स्थिति.
rowIntegerपंक्ति की जगह.
offsetXIntegerपिक्सल में सेल के कोने से हॉरिज़ॉन्टल ऑफ़सेट.
offsetYIntegerपिक्सल में सेल के कोने से वर्टिकल ऑफ़सेट.

रिटर्न

OverGridImage — डाली गई इमेज.

अनुमति

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

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

insertRowAfter(afterPosition)

दी गई पंक्ति की जगह के बाद पंक्ति शामिल करता है.

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

// This inserts a row after the first row position
sheet.insertRowAfter(1);

पैरामीटर

नामटाइपब्यौरा
afterPositionIntegerवह लाइन जिसके बाद नई लाइन जोड़नी है.

रिटर्न

Sheet — शीट, मेथड चेन में काम की है

अनुमति

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

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

insertRowBefore(beforePosition)

दी गई पंक्ति की जगह से पहले पंक्ति शामिल करता है.

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

// This inserts a row before the first row position
sheet.insertRowBefore(1);

पैरामीटर

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

रिटर्न

Sheet — शीट, मेथड चेन में काम की है

अनुमति

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

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

insertRowsAfter(afterPosition, howMany)

दी गई पंक्ति की जगह के बाद कई पंक्तियां शामिल करता है.

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

// This inserts five rows after the first row
sheet.insertRowsAfter(1, 5);

पैरामीटर

नामटाइपब्यौरा
afterPositionIntegerवह लाइन जिसके बाद नई लाइनें जोड़नी हैं.
howManyIntegerडाली जाने वाली पंक्तियों की संख्या.

रिटर्न

Sheet — शीट, मेथड चेन में काम की है

अनुमति

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

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

insertRowsBefore(beforePosition, howMany)

दी गई पंक्ति की जगह से पहले कई पंक्तियां शामिल करता है.

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

// This inserts five rows before the first row
sheet.insertRowsBefore(1, 5);

पैरामीटर

नामटाइपब्यौरा
beforePositionIntegerवह लाइन जिससे पहले नई लाइनें जोड़नी हैं.
howManyIntegerडाली जाने वाली पंक्तियों की संख्या.

रिटर्न

Sheet — शीट, मेथड चेन में काम की है

अनुमति

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

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

insertSheet()

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

var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.insertSheet();

रिटर्न

Sheet — नई शीट.

अनुमति

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

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

insertSheet(sheetIndex)

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

var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.insertSheet(1);

पैरामीटर

नामटाइपब्यौरा
sheetIndexIntegerनई बनाई गई शीट का इंडेक्स. स्प्रेडशीट में किसी शीट को पहली शीट के तौर पर डालने के लिए, उसे 0 पर सेट करें.

रिटर्न

Sheet — नई शीट.

अनुमति

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

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

insertSheet(sheetIndex, options)

दिए गए इंडेक्स की स्प्रेडशीट में नई शीट शामिल करता है और वैकल्पिक बेहतर तर्कों का इस्तेमाल करता है. नई शीट, ऐक्टिव शीट बन जाती है.

var ss = SpreadsheetApp.getActiveSpreadsheet();
var templateSheet = ss.getSheetByName('Sales');
ss.insertSheet(1, {template: templateSheet});

पैरामीटर

नामटाइपब्यौरा
sheetIndexIntegerनई बनाई गई शीट का इंडेक्स. स्प्रेडशीट में किसी शीट को पहली शीट के तौर पर डालने के लिए, उसे 0 पर सेट करें.
optionsObjectवैकल्पिक JavaScript बेहतर तर्क.

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

नामटाइपब्यौरा
templateSheetटेंप्लेट शीट ऑब्जेक्ट का सारा डेटा, नई शीट में कॉपी किया जाता है. शीट टेंप्लेट, स्प्रेडशीट ऑब्जेक्ट की कोई एक शीट होनी चाहिए.

रिटर्न

Sheet — नई शीट.

अनुमति

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

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

insertSheet(options)

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

var ss = SpreadsheetApp.getActiveSpreadsheet();
var templateSheet = ss.getSheetByName('Sales');
ss.insertSheet({template: templateSheet});

पैरामीटर

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

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

नामटाइपब्यौरा
templateSheetटेंप्लेट शीट ऑब्जेक्ट का सारा डेटा, नई शीट में कॉपी किया जाता है. शीट टेंप्लेट इस स्प्रेडशीट ऑब्जेक्ट की कोई एक शीट होनी चाहिए.

रिटर्न

Sheet — नई शीट.

अनुमति

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

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

insertSheet(sheetName)

स्प्रेडशीट में दिए गए नाम वाली नई शीट को शामिल करता है. नई शीट, सक्रिय शीट बन जाती है.

var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.insertSheet('My New Sheet');

पैरामीटर

नामटाइपब्यौरा
sheetNameStringनई शीट का नाम.

रिटर्न

Sheet — नई शीट.

अनुमति

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

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

insertSheet(sheetName, sheetIndex)

दिए गए इंडेक्स में दिए गए नाम के साथ स्प्रेडशीट में एक नई शीट डालता है. नई शीट, एक्टिव शीट बन जाती है.

var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.insertSheet('My New Sheet', 1);

पैरामीटर

नामटाइपब्यौरा
sheetNameStringनई शीट का नाम.
sheetIndexIntegerनई बनाई गई शीट का इंडेक्स. स्प्रेडशीट में किसी शीट को पहली शीट के तौर पर डालने के लिए, उसे 0 पर सेट करें.

रिटर्न

Sheet — नई शीट.

अनुमति

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

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

insertSheet(sheetName, sheetIndex, options)

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

var ss = SpreadsheetApp.getActiveSpreadsheet();
var templateSheet = ss.getSheetByName('Sales');
ss.insertSheet('My New Sheet', 1, {template: templateSheet});

पैरामीटर

नामटाइपब्यौरा
sheetNameStringनई शीट का नाम.
sheetIndexIntegerनई शामिल की गई शीट का इंडेक्स. स्प्रेडशीट में किसी शीट को पहली बार इस्तेमाल करने के लिए 0 पर सेट करें.
optionsObjectवैकल्पिक JavaScript बेहतर तर्क.

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

नामटाइपब्यौरा
templateSheetटेंप्लेट शीट ऑब्जेक्ट का सारा डेटा, नई शीट में कॉपी किया जाता है. शीट टेंप्लेट, स्प्रेडशीट ऑब्जेक्ट की कोई एक शीट होनी चाहिए.

रिटर्न

Sheet — नई शीट.

अनुमति

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

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

insertSheet(sheetName, options)

स्प्रेडशीट में दिए गए नाम वाली नई शीट शामिल करता है और वैकल्पिक बेहतर तर्कों का इस्तेमाल करता है. नई शीट, ऐक्टिव शीट बन जाती है.

var ss = SpreadsheetApp.getActiveSpreadsheet();
var templateSheet = ss.getSheetByName('Sales');
ss.insertSheet('My New Sheet', {template: templateSheet});

पैरामीटर

नामटाइपब्यौरा
sheetNameStringनई शीट का नाम.
optionsObjectवैकल्पिक JavaScript बेहतर तर्क.

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

नामटाइपब्यौरा
templateSheetटेंप्लेट शीट ऑब्जेक्ट का सारा डेटा, नई शीट में कॉपी किया जाता है. शीट टेंप्लेट, स्प्रेडशीट ऑब्जेक्ट की कोई एक शीट होनी चाहिए.

रिटर्न

Sheet — नई शीट.

अनुमति

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

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

insertSheetWithDataSourceTable(spec)

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

अगर डेटा सोर्स का टाइप चालू नहीं है, तो यह एक अपवाद है. किसी खास तरह के डेटा सोर्स का डेटा एक्ज़ीक्यूशन करने के लिए, SpreadsheetApp#enable...Execution() तरीके का इस्तेमाल करें.

// Activates BigQuery operations.
SpreadsheetApp.enableBigQueryExecution();

// 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');

// Adds a sheet and sets cell A1 as the parameter cell.
const parameterCell = ss.insertSheet('parameterSheet').getRange('A1');

// Sets the value of the parameter cell to 'Duke'.
parameterCell.setValue('Duke');

const query = 'select * from `bigquery-public-data`.`ncaa_basketball`.' +
  '`mbb_historical_tournament_games` WHERE win_school_ncaa = @SCHOOL';

// Adds a data source with a query parameter.
// TODO(developer): Update the project ID to your own Google Cloud project ID.
const dataSourceSpec = SpreadsheetApp.newDataSourceSpec()
 .asBigQuery()
 .setProjectId('project-id-1')
 .setRawQuery(query)
 .setParameterFromCell('SCHOOL', 'parameterSheet!A1')
 .build();

// Adds sheets for the data source and data source table to the spreadsheet.
ss.insertSheetWithDataSourceTable(dataSourceSpec);

पैरामीटर

नामटाइपब्यौरा
specDataSourceSpecउस डेटा सोर्स की खास बातें जिसे शामिल करना है.

रिटर्न

Sheet — नई शीट.

अनुमति

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

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

isColumnHiddenByUser(columnPosition)

यह दिखाता है कि उपयोगकर्ता ने कॉलम छिपाया है या नहीं.

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

// Columns start at 1
Logger.log(sheet.isColumnHiddenByUser(1));

पैरामीटर

नामटाइपब्यौरा
columnPositionIntegerजांच किए जाने वाले कॉलम की जगह.

रिटर्न

Boolean — अगर कॉलम छिपा हुआ है, तो true. अगर ऐसा नहीं है, तो false.

अनुमति

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

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

isIterativeCalculationEnabled()

यह दिखाता है कि इस स्प्रेडशीट में बार-बार होने वाली कैलकुलेशन की सुविधा चालू है या नहीं.

// Opens the spreadsheet file 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');

// Activates iterative calculation on the spreadsheet.
ss.setIterativeCalculationEnabled(true);

// Logs whether iterative calculation is activated for the spreadsheet.
console.log(ss.isIterativeCalculationEnabled());

रिटर्न

Boolean — अगर बार-बार होने वाली कैलकुलेशन चालू है, तो true. अगर ऐसा नहीं है, तो false.

अनुमति

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

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

isRowHiddenByFilter(rowPosition)

यह दिखाता है कि दी गई पंक्ति किसी फ़िल्टर (फ़िल्टर व्यू नहीं) से छिपी हुई है या नहीं.

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

// Rows start at 1
Logger.log(sheet.isRowHiddenByFilter(1));

पैरामीटर

नामटाइपब्यौरा
rowPositionIntegerजांच करने के लिए पंक्ति की जगह.

रिटर्न

Boolean — अगर लाइन छिपी हुई है, तो true. अगर ऐसा नहीं है, तो false.

अनुमति

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

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

isRowHiddenByUser(rowPosition)

यह दिखाता है कि उपयोगकर्ता ने दी गई पंक्ति को छिपाया है या नहीं.

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

// Rows start at 1
Logger.log(sheet.isRowHiddenByUser(1));

पैरामीटर

नामटाइपब्यौरा
rowPositionIntegerजांच करने के लिए पंक्ति की जगह.

रिटर्न

Boolean — अगर लाइन छिपी हुई है, तो true. अगर ऐसा नहीं है, तो false.

अनुमति

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

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

moveActiveSheet(pos)

सक्रिय शीट को शीट की सूची में दी गई स्थिति पर ले जाता है. अगर स्थिति ऋणात्मक है या शीट की संख्या से ज़्यादा है, तो अपवाद देता है.

// This example assumes that there are 2 sheets in the current
// active spreadsheet: one named "first" in position 1 and another named "second"
// in position 2.
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
// Gets the "first" sheet and activates it.
var sheet = spreadsheet.getSheetByName("first").activate();

// Logs 'Current index of sheet: 1'
console.log("Current index of sheet: %s", sheet.getIndex());

spreadsheet.moveActiveSheet(2);

// Logs 'New index of sheet: 2'
console.log("New index of sheet: %s", sheet.getIndex());

पैरामीटर

नामटाइपब्यौरा
posIntegerऐक्टिव शीट को शीट की सूची में ले जाने के लिए 1-इंडेक्स की जगह.

अनुमति

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

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

moveChartToObjectSheet(chart)

एक नई SheetType.OBJECT शीट बनाता है और दिए गए चार्ट को उसमें ले जाता है. अगर चार्ट पहले से ही अपनी शीट में है, तो वह शीट नई शीट के बिना ही वापस दिखाई जाती है.

var sheet = SpreadsheetApp.getActiveSheet();
var chart = sheet.newChart().setPosition(1, 1, 0, 0).build();
sheet.insertChart(chart);
var objectSheet = SpreadsheetApp.getActive().moveChartToObjectSheet(chart);

पैरामीटर

नामटाइपब्यौरा
chartEmbeddedChartवह चार्ट जिसे दूसरी जगह ले जाना है.

रिटर्न

Sheet — वह शीट जिस पर चार्ट है.

अनुमति

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

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

refreshAllDataSources()

यह काम करने वाले सभी डेटा सोर्स और उनसे लिंक किए गए डेटा सोर्स ऑब्जेक्ट को रीफ़्रेश करता है. साथ ही, अमान्य डेटा सोर्स ऑब्जेक्ट को छोड़ देता है.

किसी खास तरह के डेटा सोर्स के लिए डेटा चलाने की सुविधा चालू करने के लिए, SpreadsheetApp#enable...Execution() तरीका इस्तेमाल करें.

// Activates BigQuery operations.
SpreadsheetApp.enableBigQueryExecution();

// 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 the first data source sheet on the spreadsheet.
const dataSheet = ss.getDataSourceSheets()[0];

// Refreshes all data sources on the spreadsheet.
ss.refreshAllDataSources();

// Logs the last refreshed time of the first data source sheet.
console.log(`Last refresh time: ${dataSheet.getStatus().getLastRefreshedTime()}`);

अनुमति

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

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

removeEditor(emailAddress)

Spreadsheet के लिए एडिटर की सूची से, दिए गए उपयोगकर्ता को हटाता है. अगर उपयोगकर्ता, सामान्य ऐक्सेस वाले उपयोगकर्ताओं की कैटगरी में हैं, तो भी यह तरीका Spreadsheet को ऐक्सेस करने से नहीं रोक सकता. उदाहरण के लिए, अगर Spreadsheet को उपयोगकर्ता के पूरे डोमेन के साथ शेयर किया गया है या Spreadsheet शेयर की गई ड्राइव में है, जिसे उपयोगकर्ता ऐक्सेस कर सकता है.

Drive फ़ाइलों के लिए, इससे उपयोगकर्ता दर्शक की सूची से भी हट जाता है.

पैरामीटर

नामटाइपब्यौरा
emailAddressStringजिस व्यक्ति को हटाना है उसका ईमेल पता.

रिटर्न

Spreadsheet — यह Spreadsheet, चेन बनाने के लिए है.

अनुमति

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

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

removeEditor(user)

Spreadsheet के लिए एडिटर की सूची से, दिए गए उपयोगकर्ता को हटाता है. अगर उपयोगकर्ता, सामान्य ऐक्सेस वाले उपयोगकर्ताओं की कैटगरी में हैं, तो भी यह तरीका Spreadsheet को ऐक्सेस करने से नहीं रोक सकता. उदाहरण के लिए, अगर Spreadsheet को उपयोगकर्ता के पूरे डोमेन के साथ शेयर किया गया है या Spreadsheet शेयर की गई ड्राइव में है, जिसे उपयोगकर्ता ऐक्सेस कर सकता है.

Drive फ़ाइलों के लिए, इससे उपयोगकर्ता दर्शक की सूची से भी हट जाता है.

पैरामीटर

नामटाइपब्यौरा
userUserजिस उपयोगकर्ता को हटाना है उसके बारे में जानकारी.

रिटर्न

Spreadsheet — यह Spreadsheet, चेन बनाने के लिए है.

अनुमति

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

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

removeMenu(name)

उस मेन्यू को हटाता है जिसे addMenu(name, subMenus) ने जोड़ा था. name आर्ग्युमेंट की वैल्यू, addMenu(name, subMenus) को किए गए कॉल की वैल्यू के बराबर होनी चाहिए.

// The onOpen function is executed automatically every time a Spreadsheet is loaded
function onOpen() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  ss.addMenu("badMenu", [{name: "remove bad menu", functionName: "removeBadMenu"},
                                       {name: "foo", functionName: "foo"}]);
}
function removeBadMenu() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  ss.removeMenu("badMenu");  // name must match the name used when added the menu
}
function foo(){
// Do nothing
}

पैरामीटर

नामटाइपब्यौरा
nameStringहटाए जाने वाले मेन्यू का नाम.

अनुमति

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

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

removeNamedRange(name)

दिए गए नाम वाली नाम वाली रेंज को मिटाता है. अगर स्प्रेडशीट में दिए गए नाम वाली कोई रेंज नहीं मिलती है, तो एक अपवाद देता है.

// The code below creates a new named range "foo", and then remove it.
var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.setNamedRange("foo", ss.getActiveRange());
ss.removeNamedRange("foo");

पैरामीटर

नामटाइपब्यौरा
nameStringरेंज का नाम.

अनुमति

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

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

removeViewer(emailAddress)

ऐसा करने से, Spreadsheet के लिए दर्शकों और टिप्पणी करने वालों की सूची से, दिए गए उपयोगकर्ता को हटा दिया जाता है. अगर उपयोगकर्ता एक एडिटर है, न कि दर्शक या टिप्पणी करने वाला, तो इस तरीके का कोई असर नहीं होगा. अगर उपयोगकर्ता, सामान्य ऐक्सेस वाले उपयोगकर्ताओं की कैटगरी में आते हैं, तो भी लोग Spreadsheet को ऐक्सेस कर सकते हैं. उदाहरण के लिए, अगर Spreadsheet को उपयोगकर्ता के पूरे डोमेन के साथ शेयर किया गया हो या Spreadsheet किसी'शेयर की गई ड्राइव' में हो, जिसे उपयोगकर्ता ऐक्सेस कर सके.

Drive फ़ाइलों के लिए, इससे उपयोगकर्ता एडिटर की सूची से भी हट जाता है.

पैरामीटर

नामटाइपब्यौरा
emailAddressStringजिस व्यक्ति को हटाना है उसका ईमेल पता.

रिटर्न

Spreadsheet — यह Spreadsheet चेन बनाने के लिए है.

अनुमति

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

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

removeViewer(user)

ऐसा करने से, Spreadsheet के लिए दर्शकों और टिप्पणी करने वालों की सूची से, दिए गए उपयोगकर्ता को हटा दिया जाता है. अगर उपयोगकर्ता एक एडिटर है, न कि दर्शक, तो इस तरीके का कोई असर नहीं पड़ता. अगर उपयोगकर्ता, सामान्य ऐक्सेस वाले उपयोगकर्ताओं की कैटगरी में आते हैं, तो भी लोग Spreadsheet को ऐक्सेस कर सकते हैं. उदाहरण के लिए, अगर Spreadsheet को उपयोगकर्ता के पूरे डोमेन के साथ शेयर किया गया हो या Spreadsheet शेयर की गई ड्राइव में हो, जिसे उपयोगकर्ता ऐक्सेस कर सके.

Drive फ़ाइलों के लिए, इससे उपयोगकर्ता एडिटर की सूची से भी हट जाता है.

पैरामीटर

नामटाइपब्यौरा
userUserजिस उपयोगकर्ता को हटाना है उसके बारे में जानकारी.

रिटर्न

Spreadsheet — यह Spreadsheet चेन बनाने के लिए है.

अनुमति

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

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

rename(newName)

दस्तावेज़ का नाम बदलता है.

var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.rename("This is the new name");

पैरामीटर

नामटाइपब्यौरा
newNameStringदस्तावेज़ का नया नाम.

अनुमति

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

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

renameActiveSheet(newName)

मौजूदा चालू शीट का नाम, दिए गए नए नाम के हिसाब से बदलता है.

// The code below renames the active sheet to "Hello world"
SpreadsheetApp.getActiveSpreadsheet().renameActiveSheet("Hello world");

पैरामीटर

नामटाइपब्यौरा
newNameStringमौजूदा चालू शीट का नया नाम.

अनुमति

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

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

resetSpreadsheetTheme()

लागू की गई थीम हटाता है और स्प्रेडशीट पर डिफ़ॉल्ट थीम सेट करता है.

// The code below applies default theme on the spreadsheet.
SpreadsheetApp.getActiveSpreadsheet().resetSpreadsheetTheme();

रिटर्न

SpreadsheetTheme — डिफ़ॉल्ट थीम.

अनुमति

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

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

setActiveRange(range)

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

var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var range = sheet.getRange('A1:D4');
sheet.setActiveRange(range);

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

पैरामीटर

नामटाइपब्यौरा
rangeRangeसक्रिय श्रेणी के रूप में सेट की जाने वाली श्रेणी.

रिटर्न

Range — चालू की गई नई रेंज

अनुमति

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

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

setActiveRangeList(rangeList)

यह ऐक्टिव शीट में रेंज की सूची को active ranges के तौर पर सेट करता है. सूची में आखिरी रेंज को active range के तौर पर सेट किया गया है.

var sheet = SpreadsheetApp.getActiveSheet();
var rangeList = sheet.getRangeList(['D4', 'B2:C4']);
sheet.setActiveRangeList(rangeList);

var selection = sheet.getSelection();
// Current cell: B2
var currentCell = selection.getCurrentCell();
// Active range: B2:C4
var activeRange = selection.getActiveRange();
// Active range list: [D4, B2:C4]
var activeRangeList = selection.getActiveRangeList();

पैरामीटर

नामटाइपब्यौरा
rangeListRangeListचुनी जाने वाली रेंज की सूची.

रिटर्न

RangeList — चुनी गई नई रेंज की सूची

अनुमति

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

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

setActiveSelection(range)

इस शीट के लिए चुने जाने का सक्रिय क्षेत्र सेट करता है.

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

var range = sheet.getRange("A1:D4");
sheet.setActiveSelection(range);

पैरामीटर

नामटाइपब्यौरा
rangeRangeसक्रिय चुनाव के रूप में सेट की जाने वाली श्रेणी.

रिटर्न

Range — चालू की गई नई रेंज

अनुमति

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

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

setActiveSelection(a1Notation)

A1 नोटेशन या R1C1 नोटेशन में बताए गए तरीके के हिसाब से, ऐक्टिव सिलेक्शन सेट करता है.

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

sheet.setActiveSelection("A1:D4");

पैरामीटर

नामटाइपब्यौरा
a1NotationStringवह रेंज जिसे A1 संकेतन या R1C1 संकेतन के तौर पर सक्रिय के तौर पर सेट किया जाना है.

रिटर्न

Range — चालू की गई नई रेंज

अनुमति

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

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

setActiveSheet(sheet)

दी गई शीट को स्प्रेडशीट में सक्रिय शीट के रूप में सेट करता है. Google Sheets का यूज़र इंटरफ़ेस (यूआई), चुनी गई शीट को तब तक दिखाता है, जब तक कि वह शीट किसी दूसरी स्प्रेडशीट से न जुड़ी हो.

// The code below makes the first sheet active in the active spreadsheet.
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
spreadsheet.setActiveSheet(spreadsheet.getSheets()[0]);

पैरामीटर

नामटाइपब्यौरा
sheetSheetसक्रिय शीट के तौर पर सेट करने के लिए शीट.

रिटर्न

Sheet — चालू शीट.

अनुमति

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

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

setActiveSheet(sheet, restoreSelection)

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

var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var firstSheet = spreadsheet.getSheets()[0];
var secondSheet = spreadsheet.getSheets()[1];
// Set the first sheet as the active sheet and select the range D4:F4.
spreadsheet.setActiveSheet(firstSheet).getRange('D4:F4').activate();

// Switch to the second sheet to do some work.
spreadsheet.setActiveSheet(secondSheet);
// Switch back to first sheet, and restore its selection.
spreadsheet.setActiveSheet(firstSheet, true);

// The selection of first sheet is restored, and it logs D4:F4
var range = spreadsheet.getActiveSheet().getSelection().getActiveRange();
Logger.log(range.getA1Notation());

पैरामीटर

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

रिटर्न

Sheet — नई चालू शीट.

अनुमति

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

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

setColumnWidth(columnPosition, width)

दिए गए कॉलम की चौड़ाई को पिक्सल में सेट करता है.

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

// Sets the first column to a width of 200 pixels
sheet.setColumnWidth(1, 200);

पैरामीटर

नामटाइपब्यौरा
columnPositionIntegerसेट किए जाने वाले कॉलम की स्थिति.
widthIntegerपिक्सल में चौड़ाई, जिसे सेट करना है.

रिटर्न

Sheet — शीट, मेथड चेन में काम की है

अनुमति

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

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

setCurrentCell(cell)

बताए गए सेल को current cell के तौर पर सेट करता है.

अगर कोई सेल पहले से चुनी गई किसी रेंज में मौजूद है, तो वह रेंज मौजूदा सेल के तौर पर सेल वाली सक्रिय रेंज बन जाती है.

अगर तय की गई सेल किसी भी चुनी गई रेंज में मौजूद नहीं है, तो चुने गए सभी मौजूदा सेल हटा दिए जाते हैं और सेल, मौजूदा सेल और सक्रिय रेंज बन जाती है.

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

var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var cell = sheet.getRange('B5');
sheet.setCurrentCell(cell);

var selection = sheet.getSelection();
// Current cell: B5
var currentCell = selection.getCurrentCell();

पैरामीटर

नामटाइपब्यौरा
cellRangeमौजूदा सेल के तौर पर सेट किया जाने वाला सेल.

रिटर्न

Range — नया सेट किया गया मौजूदा सेल

अनुमति

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

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

setFrozenColumns(columns)

कॉलम की दी गई संख्या को फ़्रीज़ करता है. अगर शून्य है, तो कोई भी कॉलम फ़्रीज़ नहीं किया गया है.

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

// Freezes the first column
sheet.setFrozenColumns(1);

पैरामीटर

नामटाइपब्यौरा
columnsIntegerफ़्रीज़ किए जाने वाले कॉलम की संख्या.

अनुमति

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

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

setFrozenRows(rows)

पंक्तियों की दी गई संख्या को फ़्रीज़ करता है. अगर शून्य है, तो कोई भी पंक्ति फ़्रीज़ नहीं की गई है.

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

// Freezes the first row
sheet.setFrozenRows(1);

पैरामीटर

नामटाइपब्यौरा
rowsIntegerफ़्रीज़ की जाने वाली पंक्तियों की संख्या.

अनुमति

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

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

setIterativeCalculationConvergenceThreshold(minThreshold)

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

// Opens the spreadsheet file 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');

// Sets the iterative calculation convergence threshold for the spreadsheet.
ss.setIterativeCalculationConvergenceThreshold(2);

// Logs the threshold to the console.
console.log(ss.getIterativeCalculationConvergenceThreshold());

पैरामीटर

नामटाइपब्यौरा
minThresholdNumberकन्वर्ज़न की कम से कम सीमा (शून्य से बड़ी नहीं होनी चाहिए).

रिटर्न

Spreadsheet — यह स्प्रेडशीट, चेन बनाने के लिए है.

अनुमति

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

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

setIterativeCalculationEnabled(isEnabled)

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

// Opens the spreadsheet file 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');

// Activates iterative calculation on the spreadsheet.
ss.setIterativeCalculationEnabled(true);

// Logs whether iterative calculation is activated for the spreadsheet.
console.log(ss.isIterativeCalculationEnabled());

पैरामीटर

नामटाइपब्यौरा
isEnabledBooleanअगर बार-बार कैलकुलेशन करने की सुविधा चालू होनी चाहिए, तो true. ऐसा नहीं होने पर false.

रिटर्न

Spreadsheet — यह स्प्रेडशीट, चेन बनाने के लिए है.

अनुमति

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

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

setMaxIterativeCalculationCycles(maxIterations)

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

// Opens the spreadsheet file 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');

// Sets the max iterative calculation cycles for the spreadsheet.
ss.setMaxIterativeCalculationCycles(10);

// Logs the max iterative calculation cycles to the console.
console.log(ss.getMaxIterativeCalculationCycles());

पैरामीटर

नामटाइपब्यौरा
maxIterationsIntegerकैलकुलेशन के दोहराने की ज़्यादा से ज़्यादा संख्या (1 और 10,000 के बीच).

रिटर्न

Spreadsheet — यह स्प्रेडशीट, चेन बनाने के लिए है.

अनुमति

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

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

setNamedRange(name, range)

किसी रेंज को नाम देता है.

// The code below creates a new named range "TaxRates" in the active spreadsheet
var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.setNamedRange("TaxRates", SpreadsheetApp.getActiveRange());

पैरामीटर

नामटाइपब्यौरा
nameStringरेंज को दिया जाने वाला नाम.
rangeRangeरेंज की खास बातें.

अनुमति

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

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

setRecalculationInterval(recalculationInterval)

सेट करता है कि इस स्प्रेडशीट को कितनी बार फिर से कैलकुलेट करना चाहिए.

// 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');

// Sets the  calculation interval for the spreadsheet to 'ON_CHANGE'.
const interval = ss.setRecalculationInterval(SpreadsheetApp.RecalculationInterval.ON_CHANGE);

// Logs the calculation interval to the console.
console.log(interval);

पैरामीटर

नामटाइपब्यौरा
recalculationIntervalRecalculationIntervalरीकैलकुलेशन का नया इंटरवल.

रिटर्न

Spreadsheet — यह स्प्रेडशीट, चेन बनाने के लिए है.

अनुमति

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

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

setRowHeight(rowPosition, height)

किसी पंक्ति की ऊंचाई को पिक्सल में सेट करता है. डिफ़ॉल्ट रूप से, सेल के कॉन्टेंट के हिसाब से पंक्तियां बढ़ती जाती हैं. अगर आपको पंक्तियों को तय ऊंचाई पर लागू करना है, तो Sheet.setRowHeightsForced(startRow, numRows, height) का इस्तेमाल करें.

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

// Sets the first row to a height of 200 pixels
sheet.setRowHeight(1, 200);

पैरामीटर

नामटाइपब्यौरा
rowPositionIntegerपंक्ति की जगह बदलें.
heightIntegerपिक्सल में वह ऊंचाई जिस पर सेट करना है.

रिटर्न

Sheet — यह शीट, मेथड चेन में काम की है.

अनुमति

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

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

setSpreadsheetLocale(locale)

स्प्रेडशीट की स्थान-भाषा सेट करता है.

// Opens the spreadsheet file 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');

// Sets the spreadsheet locale.
ss.setSpreadsheetLocale('fr');

// Gets the spreadsheet locale.
const ssLocale = ss.getSpreadsheetLocale();

// Logs the locale to the console.
console.log(ssLocale);

पैरामीटर

नामटाइपब्यौरा
localeStringइस्तेमाल किया जाने वाला स्थान-भाषा कोड (उदाहरण के लिए, 'en', 'fr' या 'en_US').

अनुमति

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

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

setSpreadsheetTheme(theme)

स्प्रेडशीट पर थीम सेट करता है.

var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
// The code below sets the second predefined theme as the current theme of the spreadsheet.
var predefinedThemesList = spreadsheet.getPredefinedSpreadsheetThemes();
spreadsheet.setSpreadsheetTheme(predefinedThemesList[1]);

पैरामीटर

नामटाइपब्यौरा
themeSpreadsheetThemeलागू की जाने वाली थीम.

रिटर्न

SpreadsheetTheme — नई मौजूदा थीम.

अनुमति

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

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

setSpreadsheetTimeZone(timezone)

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

// Opens the spreadsheet file 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');

// Sets the time zone of the spreadsheet.
ss.setSpreadsheetTimeZone('America/New_York');

// Gets the time zone of the spreadsheet.
const ssTimeZone = ss.getSpreadsheetTimeZone();

// Logs the time zone to the console.
console.log(ssTimeZone);

पैरामीटर

नामटाइपब्यौरा
timezoneStringटाइम ज़ोन, जिसे "लंबा" फ़ॉर्मैट में बताया गया है (उदाहरण के लिए, "America/New_York", जैसा कि Joda.org में बताया गया है).

अनुमति

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

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

show(userInterface)

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

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

यह कोड स्निपेट, एक सामान्य HtmlService ऐप्लिकेशन को एक डायलॉग में दिखाता है. इसमें टाइटल, ऊंचाई, और चौड़ाई की जानकारी शामिल होती है:

var htmlApp = HtmlService
    .createHtmlOutput('<p>A change of speed, a change of style...</p>')
    .setTitle('My HtmlService Application')
    .setWidth(250)
    .setHeight(300);

SpreadsheetApp.getActiveSpreadsheet().show(htmlApp);

// The script resumes execution immediately after showing the dialog.

पैरामीटर

नामटाइपब्यौरा
userInterfaceObjectएक HtmlOutput.

अनुमति

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

  • https://www.googleapis.com/auth/script.container.ui

sort(columnPosition)

शीट को कॉलम के हिसाब से बढ़ते क्रम में लगाता है.

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

// Sorts the sheet by the first column, ascending
sheet.sort(1);

पैरामीटर

नामटाइपब्यौरा
columnPositionIntegerक्रम से लगाने के लिए कॉलम.

रिटर्न

Sheet — शीट, मेथड चेन में काम की है

अनुमति

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

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

sort(columnPosition, ascending)

शीट को कॉलम के हिसाब से क्रम में लगाता है. बढ़ते या घटते क्रम में तय करने के लिए पैरामीटर लेता है.

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

// Sorts the sheet by the first column, descending
sheet.sort(1, false);

पैरामीटर

नामटाइपब्यौरा
columnPositionIntegerक्रम से लगाने के लिए कॉलम.
ascendingBooleanबढ़ते क्रम में true और घटते क्रम में false.

रिटर्न

Sheet — शीट, मेथड चेन में काम की है

अनुमति

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

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

toast(msg)

दिए गए मैसेज वाली स्प्रेडशीट के नीचे दाएं कोने में एक पॉप-अप विंडो दिखाता है.

// Show a popup with the message "Task started".
SpreadsheetApp.getActiveSpreadsheet().toast('Task started');

पैरामीटर

नामटाइपब्यौरा
msgStringटोस्ट में दिखाया जाने वाला मैसेज.

अनुमति

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

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

toast(msg, title)

स्प्रेडशीट के नीचे दाएं कोने में, दिए गए मैसेज और टाइटल के साथ एक पॉप-अप विंडो दिखाता है.

// Show a popup with the title "Status" and the message "Task started".
SpreadsheetApp.getActiveSpreadsheet().toast('Task started', 'Status');

पैरामीटर

नामटाइपब्यौरा
msgStringटोस्ट में दिखाया जाने वाला मैसेज.
titleStringटोस्ट का वैकल्पिक टाइटल.

अनुमति

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

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

toast(msg, title, timeoutSeconds)

स्प्रेडशीट के नीचे दाएं कोने में, दिए गए शीर्षक और मैसेज के साथ एक पॉप-अप विंडो दिखाता है, जो तय समय तक दिखता रहता है.

// Show a 3-second popup with the title "Status" and the message "Task started".
SpreadsheetApp.getActiveSpreadsheet().toast('Task started', 'Status', 3);

पैरामीटर

नामटाइपब्यौरा
msgStringटोस्ट में दिखाया जाने वाला मैसेज.
titleStringटोस्ट का वैकल्पिक टाइटल.
timeoutSecondsNumberसेकंड में टाइम आउट. अगर null हो, तो टोस्ट डिफ़ॉल्ट रूप से पांच सेकंड का हो जाता है. अगर नेगेटिव वैल्यू दिखती है, तो टोस्ट खारिज होने तक बना रहता है.

अनुमति

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

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

unhideColumn(column)

दी गई रेंज में कॉलम दिखाता है.

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

// This unhides the first column if it was previously hidden
var range = sheet.getRange("A1");
sheet.unhideColumn(range);

पैरामीटर

नामटाइपब्यौरा
columnRangeवह रेंज जिसे दिखाना है, अगर वह छिपा हुआ है.

अनुमति

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

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

unhideRow(row)

दी गई रेंज में पंक्ति दिखाता है.

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

// This unhides the first row if it was previously hidden
var range = sheet.getRange("A1");
sheet.unhideRow(range);

पैरामीटर

नामटाइपब्यौरा
rowRangeवह रेंज जिसे दिखाना है, अगर वह छिपा हुआ है.

अनुमति

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

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

updateMenu(name, subMenus)

उस मेन्यू को अपडेट करता है जिसे addMenu(name, subMenus) ने जोड़ा है. बिलकुल addMenu(name, subMenus) की तरह काम करता है.

var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [];
menuEntries.push({name: "Lone Menu Entry", functionName: "function1"});
ss.updateMenu("addMenuExample", menuEntries);

पैरामीटर

नामटाइपब्यौरा
nameStringअपडेट करने के लिए मेन्यू का नाम.
subMenusObject[]JavaScript मैप की कलेक्शन, जिसमें name और functionName पैरामीटर शामिल हैं. शामिल की गई लाइब्रेरी के फ़ंक्शन इस्तेमाल किए जा सकते हैं, जैसे कि Library.libFunction1.

अनुमति

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

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

waitForAllDataExecutionsCompletion(timeoutInSeconds)

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

पैरामीटर

नामटाइपब्यौरा
timeoutInSecondsIntegerडेटा निष्पादन के लिए इंतज़ार करने का समय, सेकंड में. यह ज़्यादा से ज़्यादा 300 सेकंड का हो सकता है.

अनुमति

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

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

काम न करने वाले तरीके