Class Form

फ़ॉर्म

ऐसा फ़ॉर्म जिसमें सभी प्रॉपर्टी और आइटम शामिल होते हैं. प्रॉपर्टी में शीर्षक, सेटिंग, और जवाब सेव करने की जगह शामिल होती हैं. आइटम में, चेकबॉक्स या रेडियो आइटम जैसे सवाल वाले आइटम शामिल होते हैं, जबकि लेआउट आइटम में पेज ब्रेक जैसी चीज़ें शामिल होती हैं. FormApp से फ़ॉर्म बनाए या ऐक्सेस किए जा सकते हैं.

// Open a form by ID and create a new spreadsheet.
var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
var ss = SpreadsheetApp.create('Spreadsheet Name');

// Update form properties via chaining.
form.setTitle('Form Name')
    .setDescription('Description of form')
    .setConfirmationMessage('Thanks for responding!')
    .setAllowResponseEdits(true)
    .setAcceptingResponses(false);

// Update the form's response destination.
form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());

तरीके

तरीकारिटर्न टाइपसंक्षिप्त विवरण
addCheckboxGridItem()CheckboxGridItemकॉलम और पंक्तियों के ग्रिड के तौर पर दिखाए गए सवाल में एक नया आइटम जोड़ता है. इसकी मदद से जवाब देने वाला, चेकबॉक्स के क्रम से हर पंक्ति में कई विकल्प चुन सकता है.
addCheckboxItem()CheckboxItemएक नया सवाल आइटम जोड़ता है जिसकी मदद से जवाब देने वाला एक या उससे ज़्यादा चेकबॉक्स चुन सकता है. साथ ही, एक वैकल्पिक "अन्य" फ़ील्ड भी चुन सकता है.
addDateItem()DateItemसवाल के लिए एक नया आइटम जोड़ता है, ताकि जवाब देने वाला व्यक्ति तारीख बता सके.
addDateTimeItem()DateTimeItemसवाल में एक नया आइटम जोड़ता है, जिसकी मदद से जवाब देने वाला तारीख और समय बता सकता है.
addDurationItem()DurationItemएक नया सवाल आइटम जोड़ता है, जिससे जवाब देने वाला व्यक्ति जवाब में लगने वाले समय को दिखा सकता है.
addEditor(emailAddress)Formदिए गए उपयोगकर्ता को Form के लिए एडिटर की सूची में जोड़ता है.
addEditor(user)Formदिए गए उपयोगकर्ता को Form के लिए एडिटर की सूची में जोड़ता है.
addEditors(emailAddresses)Formउपयोगकर्ताओं के दिए गए अरे को Form के लिए एडिटर की सूची में जोड़ता है.
addGridItem()GridItemसवालों में एक नया आइटम जोड़ता है. इसे कॉलम और पंक्तियों के ग्रिड के तौर पर दिखाया जाता है. इसकी मदद से जवाब देने वाला, रेडियो बटन के क्रम से हर पंक्ति में एक विकल्प चुन सकता है.
addImageItem()ImageItemनया लेआउट आइटम जोड़ता है, जो एक इमेज दिखाता है.
addListItem()ListItemसवाल के लिए एक नया आइटम जोड़ता है, ताकि जवाब देने वाला व्यक्ति ड्रॉपडाउन सूची से कोई एक विकल्प चुन सके.
addMultipleChoiceItem()MultipleChoiceItemसवाल में एक नया आइटम जोड़ता है, जिसकी मदद से जवाब देने वाला व्यक्ति रेडियो बटन की सूची या वैकल्पिक "अन्य" फ़ील्ड में से कोई एक विकल्प चुन सकता है.
addPageBreakItem()PageBreakItemपेज की शुरुआत के तौर पर एक नया लेआउट आइटम जोड़ता है.
addParagraphTextItem()ParagraphTextItemसवाल के लिए एक नया आइटम जोड़ता है, जिसकी मदद से जवाब देने वाले व्यक्ति को एक छोटा सा टेक्स्ट डालने की सुविधा मिलती है.
addScaleItem()ScaleItemसवाल के लिए एक नया आइटम जोड़ता है, जिसकी मदद से जवाब देने वाला व्यक्ति, रेडियो बटन के क्रम में से एक विकल्प चुन सकता है.
addSectionHeaderItem()SectionHeaderItemएक नया लेआउट आइटम जोड़ता है, जो विज़ुअल तौर पर सेक्शन की शुरुआत दिखाता है.
addTextItem()TextItemएक नया सवाल आइटम जोड़ता है जिसकी मदद से जवाब देने वाला, टेक्स्ट की एक लाइन डाल सकता है.
addTimeItem()TimeItemएक नया सवाल आइटम जोड़ता है, जिसकी मदद से जवाब देने वाला दिन का कोई समय बता सकता है.
addVideoItem()VideoItemनया लेआउट आइटम जोड़ता है, जो वीडियो दिखाता है.
canEditResponse()Booleanइससे यह तय किया जाता है कि जवाब सबमिट करने के बाद, फ़ॉर्म में जवाब में बदलाव करने का लिंक दिखता है या नहीं.
collectsEmail()Booleanइससे तय होता है कि फ़ॉर्म, जवाब देने वालों के ईमेल पते इकट्ठा करता है या नहीं.
createResponse()FormResponseफ़ॉर्म के लिए एक नया जवाब बनाता है.
deleteAllResponses()Formफ़ॉर्म के रिस्पॉन्स स्टोर से सबमिट किए गए सभी जवाब मिटा दिए जाते हैं.
deleteItem(index)voidदिए गए इंडेक्स में मौजूद, फ़ॉर्म में मौजूद सभी आइटम से आइटम मिटाता है.
deleteItem(item)voidदिए गए आइटम को हटाता है.
deleteResponse(responseId)Formफ़ॉर्म के रिस्पॉन्स स्टोर से किसी एक जवाब को मिटाता है.
getConfirmationMessage()Stringफ़ॉर्म में पुष्टि होने वाला मैसेज मिलेगा.
getCustomClosedFormMessage()Stringयह कस्टम मैसेज दिखाता है जो तब दिखता है, जब फ़ॉर्म जवाब स्वीकार नहीं कर रहा हो या कोई कस्टम मैसेज सेट न होने पर एक खाली स्ट्रिंग मिलती है.
getDescription()Stringफ़ॉर्म की जानकारी मिलती है.
getDestinationId()Stringफ़ॉर्म के रिस्पॉन्स डेस्टिनेशन के आईडी की जानकारी मिलती है.
getDestinationType()DestinationTypeइससे पता चलता है कि फ़ॉर्म के रिस्पॉन्स डेस्टिनेशन किस तरह के हैं.
getEditUrl()Stringइस यूआरएल की मदद से, फ़ॉर्म के बदलाव मोड को ऐक्सेस किया जा सकता है.
getEditors()User[]इस Form के लिए संपादकों की सूची दी जाती है.
getId()Stringफ़ॉर्म के आईडी की जानकारी मिलती है.
getItemById(id)Itemदिए गए आईडी वाले आइटम की जानकारी देता है.
getItems()Item[]फ़ॉर्म में सभी आइटम का कलेक्शन दिखाता है.
getItems(itemType)Item[]दिए गए टाइप के सभी आइटम का कलेक्शन दिखाता है.
getPublishedUrl()Stringफ़ॉर्म का जवाब देने के लिए इस्तेमाल किया जा सकने वाला यूआरएल मिलता है.
getResponse(responseId)FormResponseजवाब के आईडी के आधार पर एक फ़ॉर्म में ही जवाब मिलता है.
getResponses()FormResponse[]सभी फ़ॉर्म के जवाबों का एक कलेक्शन इकट्ठा करता है.
getResponses(timestamp)FormResponse[]किसी दिए गए तारीख और समय के बाद फ़ॉर्म के सभी जवाबों का कलेक्शन पाएं.
getShuffleQuestions()Booleanइससे यह तय होता है कि फ़ॉर्म के हर पेज पर सवालों का क्रम, किसी भी क्रम में लगाया गया है या नहीं.
getSummaryUrl()Stringइस यूआरएल को ऐक्सेस किया जाता है, जिसका इस्तेमाल फ़ॉर्म के जवाबों की खास जानकारी देखने के लिए किया जा सकता है.
getTitle()Stringफ़ॉर्म के टाइटल की जानकारी मिलती है.
hasLimitOneResponsePerUser()Booleanइससे तय होता है कि फ़ॉर्म में, हर जवाब देने वाले व्यक्ति को सिर्फ़ एक जवाब देने की अनुमति है या नहीं.
hasProgressBar()Booleanइससे यह तय होता है कि फ़ॉर्म में प्रोग्रेस बार दिखेगा या नहीं.
hasRespondAgainLink()Booleanइससे तय होता है कि जवाब देने वाले व्यक्ति के फ़ॉर्म को भरने के बाद, फ़ॉर्म में एक और जवाब सबमिट करने का लिंक दिखता है या नहीं.
isAcceptingResponses()Booleanइससे यह तय होता है कि फ़ॉर्म के ज़रिए अभी जवाब स्वीकार किए जा रहे हैं या नहीं.
isPublishingSummary()Booleanयह तय करता है कि जवाब देने वाले व्यक्ति के फ़ॉर्म को भरने के बाद, जवाबों का सारांश देखने के लिए फ़ॉर्म में एक लिंक दिखता है या नहीं.
isQuiz()Booleanइससे यह पता चलता है कि फ़ॉर्म एक क्विज़ है या नहीं.
moveItem(from, to)Itemदिए गए इंडेक्स पर मौजूद आइटम को फ़ॉर्म में मौजूद सभी आइटम में से किसी दूसरे इंडेक्स में ले जाता है.
moveItem(item, toIndex)Itemदिए गए आइटम को फ़ॉर्म में सभी आइटम में से किसी दिए गए इंडेक्स में ले जाता है.
removeDestination()Formफ़ॉर्म को जवाब देने वाली मौजूदा जगह से अनलिंक करता है.
removeEditor(emailAddress)FormForm के लिए एडिटर की सूची से, दिए गए उपयोगकर्ता को हटाता है.
removeEditor(user)FormForm के लिए एडिटर की सूची से, दिए गए उपयोगकर्ता को हटाता है.
requiresLogin()Booleanइससे तय होता है कि फ़ॉर्म में जवाब देने वालों को, जवाब देने से पहले उसी डोमेन या सबडोमेन के किसी खाते में लॉग इन करने की ज़रूरत है या नहीं.
setAcceptingResponses(enabled)Formसेट करें कि फ़ॉर्म अभी जवाब स्वीकार कर रहा है या नहीं.
setAllowResponseEdits(enabled)Formसेट करता है कि फ़ॉर्म सबमिट करने के बाद जवाब में बदलाव करने के लिए लिंक दिखाता है या नहीं.
setCollectEmail(collect)Formसेट करता है कि फ़ॉर्म, जवाब देने वालों के ईमेल पते इकट्ठा करता है या नहीं.
setConfirmationMessage(message)Formफ़ॉर्म के लिए पुष्टि करने वाला मैसेज सेट करता है.
setCustomClosedFormMessage(message)Formअगर फ़ॉर्म जवाब स्वीकार नहीं कर रहा है, तो यह मैसेज को दिखाने के लिए सेट करता है.
setDescription(description)Formफ़ॉर्म का ब्यौरा सेट करता है.
setDestination(type, id)Formवह डेस्टिनेशन सेट करता है जहां फ़ॉर्म के जवाबों को सेव किया जाता है.
setIsQuiz(enabled)Formसेट करता है कि फ़ॉर्म एक क्विज़ है या नहीं.
setLimitOneResponsePerUser(enabled)Formतय करें कि फ़ॉर्म में जवाब देने वाले व्यक्ति को सिर्फ़ एक जवाब देने की अनुमति है या नहीं.
setProgressBar(enabled)Formसेट करता है कि फ़ॉर्म में प्रोग्रेस बार है या नहीं.
setPublishingSummary(enabled)Formतय करें कि जवाब देने वाले के फ़ॉर्म सबमिट करने के बाद, फ़ॉर्म में जवाबों का सारांश देखने के लिए लिंक दिखता है या नहीं.
setRequireLogin(requireLogin)Formइससे यह तय होता है कि फ़ॉर्म में जवाब देने वालों को, जवाब देने से पहले उसी डोमेन या सबडोमेन के किसी खाते में लॉग इन करना होगा या नहीं.
setShowLinkToRespondAgain(enabled)Formइससे यह तय होता है कि जवाब देने वाले व्यक्ति के फ़ॉर्म को भरने के बाद, दूसरा जवाब सबमिट करने के लिए फ़ॉर्म में लिंक दिखता है या नहीं.
setShuffleQuestions(shuffle)Formसेट करता है कि क्या फ़ॉर्म के हर पेज पर सवालों का क्रम रैंडम किया गया है.
setTitle(title)Formफ़ॉर्म का टाइटल सेट करता है.
shortenFormUrl(url)Stringकिसी फ़ॉर्म के लंबे यूआरएल को छोटे यूआरएल में बदल देता है.
submitGrades(responses)Formदिए गए formResponses के लिए ग्रेड सबमिट करता है.

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

addCheckboxGridItem()

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

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a checkbox grid item.
const item = form.addCheckboxGridItem();

// Sets the title 'Where did you celebrate New Year's?'
item.setTitle('Where did you celebrate New Year's?');

// Sets the grid's rows and columns.
item.setRows(['New York', 'San Francisco', 'London'])
  .setColumns(['2014', '2015', '2016', '2017']);

रिटर्न

CheckboxGridItem — नया आइटम.

अनुमति देना

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

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

addCheckboxItem()

एक नया सवाल आइटम जोड़ता है जिसकी मदद से जवाब देने वाला एक या उससे ज़्यादा चेकबॉक्स चुन सकता है. साथ ही, एक वैकल्पिक "अन्य" फ़ील्ड भी चुन सकता है.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a checkbox item.
const item = form.addCheckboxItem();

// Sets the title of the checkbox item to 'Do you prefer cats or dogs?'
item.setTitle('Do you prefer cats or dogs?');

// Sets the choices.
item.setChoiceValues(['Cats', 'Dogs']);

रिटर्न

CheckboxItem — नया आइटम.

अनुमति देना

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

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

addDateItem()

सवाल के लिए एक नया आइटम जोड़ता है, ताकि जवाब देने वाला व्यक्ति तारीख बता सके.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a date item.
const item = form.addDateItem();

// Sets the title to 'When were you born?'
item.setTitle('When were you born?');

// Sets the description for the date item.
item.setHelpText('Some helper text.');

रिटर्न

DateItem — नया आइटम.

अनुमति देना

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

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

addDateTimeItem()

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

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a question with date and time inputs.
const item = form.addDateTimeItem();

// Sets the title to 'When were you born?'
item.setTitle('When were you born?');

// Sets the question as required.
item.setRequired(true);

रिटर्न

DateTimeItem — नया आइटम.

अनुमति देना

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

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

addDurationItem()

एक नया सवाल आइटम जोड़ता है, जिससे जवाब देने वाला व्यक्ति जवाब में लगने वाले समय को दिखा सकता है.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a question with a duration input.
const item = form.addDurationItem();

// Sets the title to 'How long can you hold your breath?'
item.setTitle('How long can you hold your breath?');

// Sets the question as required.
item.setRequired(true);

रिटर्न

DurationItem — नया आइटम.

अनुमति देना

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

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

addEditor(emailAddress)

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

पैरामीटर

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

रिटर्न

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

अनुमति देना

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

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

addEditor(user)

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

पैरामीटर

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

रिटर्न

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

अनुमति देना

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

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

addEditors(emailAddresses)

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

पैरामीटर

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

रिटर्न

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

अनुमति देना

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

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

addGridItem()

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

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a multiple choice grid.
const item = form.addGridItem();

// Sets the title to 'Rate your interests.'
item.setTitle('Rate your interests');

// Sets the grid's rows and columns.
item.setRows(['Cars', 'Computers', 'Celebrities'])
  .setColumns(['Boring', 'So-so', 'Interesting']);

रिटर्न

GridItem — नया आइटम.

अनुमति देना

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

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

addImageItem()

नया लेआउट आइटम जोड़ता है, जो एक इमेज दिखाता है.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds an image item.
const item = form.addImageItem();

// Gets the Google icon to use as the image.
const img = UrlFetchApp.fetch('https://fonts.gstatic.com/s/i/productlogos/googleg/v6/web-24dp/logo_googleg_color_1x_web_24dp.png');

// Sets the image, title, and description for the item.
item.setTitle('Google icon').setHelpText('Google icon').setImage(img);

रिटर्न

ImageItem — नया आइटम.

अनुमति देना

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

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

addListItem()

सवाल के लिए एक नया आइटम जोड़ता है, ताकि जवाब देने वाला व्यक्ति ड्रॉपडाउन सूची से कोई एक विकल्प चुन सके.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a dropdown list to the form.
const item = form.addListItem();

// Sets the title to 'Do you prefer cats or dogs?'
item.setTitle('Do you prefer cats or dogs?');

// Sets the description to 'This is description text...'
item.setHelpText('This is description text...');

// Creates and adds choices to the dropdown list.
item.setChoices([
  item.createChoice('dog'),
  item.createChoice('cat')
]);

रिटर्न

ListItem — नया आइटम.

अनुमति देना

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

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

addMultipleChoiceItem()

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

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a multiple choice item to the form.
const item = form.addMultipleChoiceItem();

// Sets the title.
item.setTitle('What is your favorite ice cream flavor?');

// Creates some choice items.
const vanilla = item.createChoice('vanilla');
const chocolate = item.createChoice('chocolate');
const strawberry = item.createChoice('strawberry');

// Sets the choices.
item.setChoices([vanilla, chocolate, strawberry]);

रिटर्न

MultipleChoiceItem — नया आइटम.

अनुमति देना

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

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

addPageBreakItem()

पेज की शुरुआत के तौर पर एक नया लेआउट आइटम जोड़ता है.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds page break items to create a second and third page for the form.
const pageTwo = form.addPageBreakItem();
const pageThree = form.addPageBreakItem();

// Sets the titles for the pages.
pageTwo.setTitle('Page two');
pageThree.setTitle('Page three');

// Upon completion of the first page, sets the form to navigate to the third page.
pageTwo.setGoToPage(pageThree);

// Upon completion of the second page, sets the form to navigate back to the first page.
pageThree.setGoToPage(FormApp.PageNavigationType.RESTART);

रिटर्न

PageBreakItem — नया आइटम.

अनुमति देना

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

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

addParagraphTextItem()

सवाल के लिए एक नया आइटम जोड़ता है, जिसकी मदद से जवाब देने वाले व्यक्ति को एक छोटा सा टेक्स्ट डालने की सुविधा मिलती है.

// Opens the form by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds the paragraph text item.
const item = form.addParagraphTextItem();

// Sets the title to 'What is your address?'
item.setTitle('What is your address?');

रिटर्न

ParagraphTextItem — नया आइटम.

अनुमति देना

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

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

addScaleItem()

सवाल के लिए एक नया आइटम जोड़ता है, जिसकी मदद से जवाब देने वाला व्यक्ति, रेडियो बटन के क्रम में से एक विकल्प चुन सकता है.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds the scale item.
const item = form.addScaleItem();

// Sets the title of the scale item to 'Choose a number.'
item.setTitle('Choose a number');

// Sets the scale to 1-5.
item.setBounds(1, 5);

// Sets the label for the lower and upper bounds.
item.setLabels('Lowest', 'Highest');

रिटर्न

ScaleItem — नया आइटम.

अनुमति देना

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

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

addSectionHeaderItem()

एक नया लेआउट आइटम जोड़ता है, जो विज़ुअल तौर पर सेक्शन की शुरुआत दिखाता है.

 // Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds the section heading item.
const item = form.addSectionHeaderItem();

// Sets the title to 'Title of new section.'
item.setTitle('Title of new section');

// Sets the description.
item.setHelpText('Description of new section');

रिटर्न

SectionHeaderItem — नया आइटम.

अनुमति देना

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

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

addTextItem()

एक नया सवाल आइटम जोड़ता है जिसकी मदद से जवाब देने वाला, टेक्स्ट की एक लाइन डाल सकता है.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a single-line text item.
const item = form.addTextItem();

// Sets the title to 'What is your name?'
item.setTitle('What is your name?');

रिटर्न

TextItem — नया आइटम.

अनुमति देना

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

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

addTimeItem()

एक नया सवाल आइटम जोड़ता है, जिसकी मदद से जवाब देने वाला दिन का कोई समय बता सकता है.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a question with a time input.
const item = form.addTimeItem();

// Sets the title to 'What time do you usually wake up in the morning?'
item.setTitle('What time do you usually wake up in the morning?');

रिटर्न

TimeItem — नया आइटम.

अनुमति देना

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

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

addVideoItem()

नया लेआउट आइटम जोड़ता है, जो वीडियो दिखाता है.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a video item.
const item = form.addVideoItem();

// Sets the title, description, and video.
item.setTitle('YouTube video')
  .setHelpText('Send content automatically via Google Sheets and Apps Script')
  .setVideoUrl('https://youtu.be/xxgQr-jSu9o');

// Sets the alignment to the center.
item.setAlignment(FormApp.Alignment.CENTER);

रिटर्न

VideoItem — नया आइटम.

अनुमति देना

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

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

canEditResponse()

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

इस सेटिंग पर ध्यान दिए बिना, FormResponse.getEditResponseUrl() तरीके का इस्तेमाल करके, स्क्रिप्ट लिखने वाले व्यक्ति को फ़ॉर्म में बदलाव करने का ऐक्सेस दिया जाता है. ऐसा यूआरएल जनरेट करने के लिए किया जाता है जिसका इस्तेमाल जवाब में बदलाव करने के लिए किया जा सकता है.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Checks if the form displays a link to edit a response after submitting it.
// The default is false. To let people edit their responses, use
// form.setAllowResponseEdits(true).
const edit = form.canEditResponse();

// If the form doesn't let people edit responses, logs false to the console.
console.log(edit);

रिटर्न

Booleantrue, अगर फ़ॉर्म में "अपने जवाब में बदलाव करें" लिंक दिखता है, तो false नहीं.

अनुमति देना

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

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

collectsEmail()

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

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to not collect respondents' email addresses.
form.setCollectEmail(false);

// Checks whether the form collects respondents' email addresses and logs it to the console.
const bool = form.collectsEmail();

console.log(bool);

रिटर्न

Boolean — अगर फ़ॉर्म में ईमेल पते इकट्ठा किए जाते हैं, तो true. अगर ऐसा नहीं है, तो false.

अनुमति देना

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

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

createResponse()

फ़ॉर्म के लिए एक नया जवाब बनाता है. किसी सवाल का जवाब देने के लिए, उस आइटम से ItemResponse बनाएं. इसके बाद, FormResponse.withItemResponse(response) पर कॉल करके उसे फ़ॉर्म के इस जवाब में अटैच करें. इकट्ठा किए गए जवाब को सेव करने के लिए, FormResponse.submit() को कॉल करें.

रिटर्न

FormResponse — फ़ॉर्म का नया जवाब.

अनुमति देना

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

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

deleteAllResponses()

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

रिटर्न

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

अनुमति देना

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

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

deleteItem(index)

दिए गए इंडेक्स में मौजूद, फ़ॉर्म में मौजूद सभी आइटम से आइटम मिटाता है. अगर दिए गए इंडेक्स में कोई आइटम मौजूद नहीं है, तो स्क्रिप्टिंग अपवाद को फेंकता है.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets all the items from the form.
const items = form.getItems();

// Finds the index of a paragraph text item and deletes it by the item's index.
const index = items.findIndex(item => item.getType() === FormApp.ItemType.PARAGRAPH_TEXT);
if (index !== -1) {
  form.deleteItem(index);
}

पैरामीटर

नामTypeब्यौरा
indexIntegerफ़ॉर्म में मौजूद सभी आइटम में से, आइटम का इंडेक्स.

थ्रो

Error — अगर दिए गए इंडेक्स में कोई आइटम मौजूद नहीं है

अनुमति देना

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

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

deleteItem(item)

दिए गए आइटम को हटाता है. अगर आइटम को पहले ही हटा दिया गया है, तो एक स्क्रिप्टिंग अपवाद फेंकता है.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets all of the items from the form.
const items = form.getItems();

// Finds a paragraph text item and deletes it.
const item = items.find(item => item.getType() === FormApp.ItemType.PARAGRAPH_TEXT);
if (item) {
  form.deleteItem(item);
}

पैरामीटर

नामTypeब्यौरा
itemItemमिटाया जाने वाला आइटम.

थ्रो

Error — अगर फ़ॉर्म में आइटम मौजूद नहीं है

अनुमति देना

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

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

deleteResponse(responseId)

फ़ॉर्म के रिस्पॉन्स स्टोर से किसी एक जवाब को मिटाता है. यह तरीका किसी बाहरी रिस्पॉन्स डेस्टिनेशन (जैसे, स्प्रेडशीट) में सेव किए गए रिस्पॉन्स की कॉपी नहीं मिटाता. हालांकि, जवाब को फ़ॉर्म के खास जानकारी वाले व्यू से हटा दिया जाता है. रिस्पॉन्स आईडी को FormResponse.getId() से वापस पाया जा सकता है.

पैरामीटर

नामTypeब्यौरा
responseIdStringमिटाने के लिए फ़ॉर्म के जवाब का आईडी.

रिटर्न

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

अनुमति देना

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

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

getConfirmationMessage()

फ़ॉर्म में पुष्टि होने वाला मैसेज मिलेगा.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the confirmation message to display after someone submits the form.
form.setConfirmationMessage('You successfully submitted the form.');

// Gets the confirmation message and logs it to the console.
const message = form.getConfirmationMessage();

console.log(message);

रिटर्न

String — फ़ॉर्म की पुष्टि करने वाला मैसेज.

अनुमति देना

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

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

getCustomClosedFormMessage()

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

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets a custom closed form message to display to the user when the form
// no longer accepts responses.
form.setCustomClosedFormMessage('The form is no longer accepting responses.');

// Gets the custom message set for the form and logs it to the console.
const message = form.getCustomClosedFormMessage();

console.log(message);

रिटर्न

String — अगर फ़ॉर्म में जवाब स्वीकार नहीं किए जा रहे हैं, तो पसंद के मुताबिक बनाया गया मैसेज. अगर कोई कस्टम मैसेज सेट नहीं है, तो एक खाली स्ट्रिंग.

अनुमति देना

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

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

getDescription()

फ़ॉर्म की जानकारी मिलती है.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form description.
form.setDescription('This is the form description.');

// Gets the form description and logs it to the console.
const description = form.getDescription();

console.log(description);

रिटर्न

String — फ़ॉर्म का ब्यौरा.

अनुमति देना

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

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

getDestinationId()

फ़ॉर्म के रिस्पॉन्स डेस्टिनेशन के आईडी की जानकारी मिलती है.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Creates a spreadsheet to use as the response destination.
const ss = SpreadsheetApp.create('Test_Spreadsheet');

// Updates the form's response destination.
form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());

// Gets the ID of the form's response destination and logs it to the console.
const destinationId = form.getDestinationId();

console.log(destinationId);

रिटर्न

String — फ़ॉर्म के रिस्पॉन्स डेस्टिनेशन का आईडी.

अनुमति देना

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

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

getDestinationType()

इससे पता चलता है कि फ़ॉर्म के रिस्पॉन्स डेस्टिनेशन किस तरह के हैं.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc1234556/edit');

// Gets the type of the form's response destination and logs it to the console.
const destinationType = form.getDestinationType().name();

console.log(destinationType);

रिटर्न

DestinationType — फ़ॉर्म के रिस्पॉन्स डेस्टिनेशन का टाइप.

अनुमति देना

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

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

getEditUrl()

इस यूआरएल की मदद से, फ़ॉर्म के बदलाव मोड को ऐक्सेस किया जा सकता है.

// Opens the form by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the URL that accesses the form's edit mode and logs it to the console.
const url = form.getEditUrl();

console.log(url);

रिटर्न

String — फ़ॉर्म में बदलाव करने के लिए यूआरएल.

अनुमति देना

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

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

getEditors()

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

रिटर्न

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

अनुमति देना

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

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

getId()

फ़ॉर्म के आईडी की जानकारी मिलती है.

// Opens the form by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the ID of the form and logs it to the console.
const id = form.getId();

console.log(id);

रिटर्न

String — फ़ॉर्म का आईडी.

अनुमति देना

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

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

getItemById(id)

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

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the ID of the first item on the form.
const itemId = form.getItems()[0].getId();

// Gets the item from the ID.
const item = form.getItemById(itemId);

// Gets the name of the item type and logs it to the console.
const type = item.getType().name();

console.log(type);

पैरामीटर

नामTypeब्यौरा
idIntegerआइटम का आईडी.

रिटर्न

Item — दिए गए आईडी वाला आइटम या अगर आइटम, फ़ॉर्म में मौजूद नहीं है, तो null.

अनुमति देना

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

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

getItems()

फ़ॉर्म में सभी आइटम का कलेक्शन दिखाता है.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the list of items in the form.
const items = form.getItems();

// Gets the type for each item and logs them to the console.
const types = items.map((item) => item.getType().name());

console.log(types);

रिटर्न

Item[] — फ़ॉर्म में सभी आइटम का कलेक्शन.

अनुमति देना

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

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

getItems(itemType)

दिए गए टाइप के सभी आइटम का कलेक्शन दिखाता है.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets a list of all checkbox items on the form.
const items = form.getItems(FormApp.ItemType.CHECKBOX);

// Gets the title of each checkbox item and logs them to the console.
const checkboxItemsTitle = items.map((item) => item.asCheckboxItem().getTitle());
console.log(checkboxItemsTitle);

पैरामीटर

नामTypeब्यौरा
itemTypeItemTypeवापस पाने के लिए आइटम के टाइप.

रिटर्न

Item[] — उस टाइप के सभी आइटम का कलेक्शन.

अनुमति देना

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

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

getPublishedUrl()

फ़ॉर्म का जवाब देने के लिए इस्तेमाल किया जा सकने वाला यूआरएल मिलता है.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the URL to respond to the form and logs it to the console.
const url = form.getPublishedUrl();
console.log(url);

रिटर्न

String — फ़ॉर्म का जवाब देने के लिए यूआरएल.

अनुमति देना

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

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

getResponse(responseId)

जवाब के आईडी के आधार पर एक फ़ॉर्म में ही जवाब मिलता है. रिस्पॉन्स आईडी, FormResponse.getId() से वापस पाए जा सकते हैं.

पैरामीटर

नामTypeब्यौरा
responseIdStringफ़ॉर्म में दिए गए जवाब का आईडी.

रिटर्न

FormResponse — फ़ॉर्म का जवाब.

थ्रो

Error — अगर जवाब मौजूद नहीं है

अनुमति देना

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

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

getResponses()

सभी फ़ॉर्म के जवाबों का एक कलेक्शन इकट्ठा करता है.

रिटर्न

FormResponse[] — फ़ॉर्म के सभी जवाबों का कलेक्शन.

अनुमति देना

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

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

getResponses(timestamp)

किसी दिए गए तारीख और समय के बाद फ़ॉर्म के सभी जवाबों का कलेक्शन पाएं.

पैरामीटर

नामTypeब्यौरा
timestampDateफ़ॉर्म के जवाबों को लौटाने की सबसे पहली तारीख और समय.

रिटर्न

FormResponse[] — फ़ॉर्म में दिए गए जवाबों की सूची.

अनुमति देना

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

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

getShuffleQuestions()

इससे यह तय होता है कि फ़ॉर्म के हर पेज पर सवालों का क्रम, किसी भी क्रम में लगाया गया है या नहीं.

रिटर्न

Booleantrue, अगर फ़ॉर्म के हर पेज पर सवालों का क्रम किसी भी क्रम में लगाया गया है; अगर ऐसा नहीं है, तो false.

अनुमति देना

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

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

getSummaryUrl()

इस यूआरएल को ऐक्सेस किया जाता है, जिसका इस्तेमाल फ़ॉर्म के जवाबों की खास जानकारी देखने के लिए किया जा सकता है. जब तक setPublishingSummary(enabled) को true पर सेट नहीं किया जाता, तब तक सिर्फ़ वही उपयोगकर्ता यूआरएल को ऐक्सेस कर पाएंगे जिनके पास फ़ॉर्म में बदलाव करने की अनुमति होगी.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// Opens the form by its URL.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the URL to view a summary of the form's responses and logs it to the console.
const url = form.getSummaryUrl();
console.log(url);

रिटर्न

String — जवाबों की खास जानकारी देखने के लिए यूआरएल.

अनुमति देना

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

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

getTitle()

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

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the title of the form to 'For_Testing.'
form.setTitle('For_Testing');

// Gets the title of the form and logs it to the console.
const title = form.getTitle();
console.log(title);

रिटर्न

String — फ़ॉर्म का टाइटल.

अनुमति देना

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

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

hasLimitOneResponsePerUser()

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

रिटर्न

Booleantrue, अगर फ़ॉर्म में जवाब देने वाले एक व्यक्ति को सिर्फ़ एक जवाब देने की अनुमति है, तो false.

अनुमति देना

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

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

hasProgressBar()

इससे यह तय होता है कि फ़ॉर्म में प्रोग्रेस बार दिखेगा या नहीं.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// Opens the form by its URL.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Displays the progress bar on the form.
form.setProgressBar(true);

// Checks if the form displays a progress bar and logs it to the console.
console.log(form.hasProgressBar());

रिटर्न

Booleantrue अगर फ़ॉर्म में प्रोग्रेस बार नहीं दिखता है, तो false.

अनुमति देना

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

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

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

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to display a link to submit another
// response after someone submits the form.
form.setShowLinkToRespondAgain(true);

// Checks if the form displays a 'Submit another response' link and logs it to the console.
console.log(form.hasRespondAgainLink());

रिटर्न

Booleantrue, अगर फ़ॉर्म में "दूसरा जवाब सबमिट करें" लिंक दिखता है, तो false नहीं है.

अनुमति देना

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

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

isAcceptingResponses()

इससे यह तय होता है कि फ़ॉर्म के ज़रिए अभी जवाब स्वीकार किए जा रहे हैं या नहीं.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to accept responses.
form.setAcceptingResponses(true);

// Checks if the form is accepting responses or not and logs it to the console.
const accepting = form.isAcceptingResponses();
console.log(accepting);

रिटर्न

Booleantrue अगर फ़ॉर्म से जवाब स्वीकार किए जा रहे हैं, तो false.

अनुमति देना

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

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

isPublishingSummary()

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

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to display a link to a summary of
// the responses after someone submits the form.
form.setPublishingSummary(true);

// Checks if the form displays a "See previous responses" link and logs it to the console.
const publishingLink = form.isPublishingSummary();
console.log(publishingLink);

रिटर्न

Booleantrue, अगर फ़ॉर्म में "पिछले जवाब देखें" लिंक दिखता है, तो false नहीं दिखता है. false

अनुमति देना

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

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

isQuiz()

इससे यह पता चलता है कि फ़ॉर्म एक क्विज़ है या नहीं.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form as a quiz.
form.setIsQuiz(true);

// Checks if the form is a quiz or not and logs it to the console.
console.log(form.isQuiz());

रिटर्न

Booleantrue अगर फ़ॉर्म से जवाब स्वीकार किए जा रहे हैं, तो false.

अनुमति देना

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

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

moveItem(from, to)

दिए गए इंडेक्स पर मौजूद आइटम को फ़ॉर्म में मौजूद सभी आइटम में से किसी दूसरे इंडेक्स में ले जाता है. अगर to इंडेक्स सीमा से बाहर है, तो स्क्रिप्टिंग अपवाद देता है.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Moves the first item to be the last item.
form.moveItem(0, form.getItems().length - 1);

पैरामीटर

नामTypeब्यौरा
fromIntegerफ़ॉर्म में मौजूद सभी आइटम में से, आइटम का मौजूदा इंडेक्स.
toIntegerफ़ॉर्म में मौजूद सभी आइटम में से, आइटम के लिए नया इंडेक्स.

रिटर्न

Item — वह आइटम जिसे दूसरी जगह ले जाया गया है.

थ्रो

Error — अगर दोनों में से कोई भी इंडेक्स तय सीमा से बाहर हो.

अनुमति देना

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

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

moveItem(item, toIndex)

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

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the first item.
const item = form.getItems()[0];

// Moves the item to be the last item.
form.moveItem(item, form.getItems().length - 1);

पैरामीटर

नामTypeब्यौरा
itemItemवह आइटम जिसे दूसरी जगह ले जाना है.
toIndexIntegerफ़ॉर्म में मौजूद सभी आइटम में से, आइटम के लिए नया इंडेक्स.

रिटर्न

Item — वह आइटम जिसे दूसरी जगह ले जाया गया है.

थ्रो

Error — अगर इंडेक्स, तय सीमा से ज़्यादा है.

अनुमति देना

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

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

removeDestination()

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

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Opens a spreadsheet to use for the response destination.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit');

// Updates the form's response destination to the spreadsheet.
form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());

// Unlinks the form from the spreadsheet.
form.removeDestination();

रिटर्न

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

अनुमति देना

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

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

removeEditor(emailAddress)

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

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

पैरामीटर

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

रिटर्न

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

अनुमति देना

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

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

removeEditor(user)

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

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

पैरामीटर

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

रिटर्न

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

अनुमति देना

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

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

requiresLogin()

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

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Checks if the form requires respondents to log in to a Google Workspace account
// before responding and logs it to the console.
const login = form.requiresLogin();
console.log(login);

रिटर्न

Booleantrue अगर फ़ॉर्म में उपयोगकर्ताओं को लॉग इन करना ज़रूरी है; अगर ऐसा नहीं है, तो false.


setAcceptingResponses(enabled)

सेट करें कि फ़ॉर्म अभी जवाब स्वीकार कर रहा है या नहीं. नए फ़ॉर्म के लिए, डिफ़ॉल्ट वैल्यू true है.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to accept responses.
form.setAcceptingResponses(true);

// Checks whether the form is accepting responses or not and logs it to the console.
console.log(form.isAcceptingResponses());

पैरामीटर

नामTypeब्यौरा
enabledBooleantrue अगर फ़ॉर्म में जवाब स्वीकार करने चाहिए; अगर नहीं, तो false.

रिटर्न

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

अनुमति देना

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

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

setAllowResponseEdits(enabled)

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

इस सेटिंग के बावजूद, FormResponse.getEditResponseUrl() तरीके से, स्क्रिप्ट लिखने वाले ऐसे व्यक्ति को फ़ॉर्म में बदलाव करने की अनुमति मिलती है जिसके पास यूआरएल जनरेट करने की अनुमति होती है. इस यूआरएल का इस्तेमाल जवाब में बदलाव करने के लिए किया जा सकता है.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Shows "Edit your response" link after someone submits the form.
form.setAllowResponseEdits(true);

// Checks whether the option to edit the form after a user submits it is set to true or not
// and logs it to the console.
console.log(form.canEditResponse());

पैरामीटर

नामTypeब्यौरा
enabledBooleantrue, अगर फ़ॉर्म में "अपने जवाब में बदलाव करें" लिंक दिखना चाहिए; अगर ऐसा नहीं है, तो false.

रिटर्न

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

अनुमति देना

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

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

setCollectEmail(collect)

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

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to collect respondents' email addresses.
form.setCollectEmail(true);

// Checks whether the value is set to true or false and logs it to the console.
const collect = form.collectsEmail();
console.log(collect);

पैरामीटर

नामTypeब्यौरा
collectBooleanअगर फ़ॉर्म में ईमेल पते इकट्ठा किए जाने चाहिए, तो true. अगर ऐसा नहीं है, तो false.

रिटर्न

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

अनुमति देना

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

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

setConfirmationMessage(message)

फ़ॉर्म के लिए पुष्टि करने वाला मैसेज सेट करता है.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets a custom confirmation message to display after someone submits the form.
form.setConfirmationMessage('Your form has been successfully submitted.');

// Gets the confirmation message set for the form and logs it to the console.
const message = form.getConfirmationMessage();
console.log(message);

पैरामीटर

नामTypeब्यौरा
messageStringफ़ॉर्म का नया पुष्टि करने वाला मैसेज.

रिटर्न

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

अनुमति देना

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

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

setCustomClosedFormMessage(message)

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

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to not accept responses.
form.setAcceptingResponses(false);

// Sets a custom closed form message to display to the user.
form.setCustomClosedFormMessage('The form is no longer accepting responses.');

// Gets the custom message set for the form and logs it to the console.
const message = form.getCustomClosedFormMessage();
console.log(message);

पैरामीटर

नामTypeब्यौरा
messageStringअगर फ़ॉर्म के जवाब स्वीकार नहीं किए जा रहे हैं, तो दिखाया जाने वाला मैसेज.

रिटर्न

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

अनुमति देना

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

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

setDescription(description)

फ़ॉर्म का ब्यौरा सेट करता है.

पैरामीटर

नामTypeब्यौरा
descriptionStringफ़ॉर्म का नया ब्यौरा.

रिटर्न

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

अनुमति देना

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

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

setDestination(type, id)

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

पैरामीटर

नामTypeब्यौरा
typeDestinationTypeफ़ॉर्म के रिस्पॉन्स डेस्टिनेशन का टाइप.
idStringफ़ॉर्म के रिस्पॉन्स डेस्टिनेशन का आईडी.

रिटर्न

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

थ्रो

Error — अगर दिया गया डेस्टिनेशन आईडी अमान्य है

अनुमति देना

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

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

setIsQuiz(enabled)

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

ग्रेड वाले सवालों की अनुमति सिर्फ़ क्विज़ में दी जाती है. इसलिए, इसे false पर सेट करने से, सभी सवालों से ग्रेड देने के सभी विकल्प हटा दिए जाते हैं.

क्विज़ की सेटिंग सिर्फ़ नए Forms के यूज़र इंटरफ़ेस (यूआई) में उपलब्ध हैं. क्विज़ को फ़ॉर्म में बदलने से, नए यूज़र इंटरफ़ेस (यूआई) का इस्तेमाल करने के लिए फ़ॉर्म चुन लिया जाता है.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Makes the form a quiz.
form.setIsQuiz(true);

// Checks whether the form is a quiz or not and logs it to the console.
console.log(form.isQuiz());

पैरामीटर

नामTypeब्यौरा
enabledBooleanअगर फ़ॉर्म में क्विज़ की सुविधाएं चालू होनी चाहिए, तो true. अगर ऐसा नहीं है, तो false.

रिटर्न

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

अनुमति देना

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

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

setLimitOneResponsePerUser(enabled)

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

पैरामीटर

नामTypeब्यौरा
enabledBooleantrue, अगर फ़ॉर्म में जवाब देने वाले व्यक्ति को सिर्फ़ एक जवाब देने की अनुमति होनी चाहिए; अगर ऐसा नहीं है, तो false.

रिटर्न

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

अनुमति देना

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

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

setProgressBar(enabled)

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

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Displays the progress bar on the form.
form.setProgressBar(true);

// Checks whether the form has a progress bar and logs it to the console.
console.log(form.hasProgressBar());

पैरामीटर

नामTypeब्यौरा
enabledBooleanअगर फ़ॉर्म में प्रोग्रेस बार दिखता है, तो true और अगर नहीं दिखता है, तो false.

रिटर्न

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

अनुमति देना

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

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

setPublishingSummary(enabled)

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

पैरामीटर

नामTypeब्यौरा
enabledBooleantrue अगर फ़ॉर्म में "पिछले जवाब देखें" लिंक दिखना चाहिए; अगर ऐसा नहीं है, तो false.

रिटर्न

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

अनुमति देना

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

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

setRequireLogin(requireLogin)

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

यह सुविधा, सिर्फ़ Google Workspace उपयोगकर्ताओं के बनाए गए फ़ॉर्म के लिए उपलब्ध है. दूसरे तरह के Google खातों के उपयोगकर्ताओं के लिए लॉग इन करने की ज़रूरत नहीं है.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form so that users must log in to their Google Workspace account.
form.setRequireLogin(true);

// Checks whether the form requires login or not and logs it to the console.
console.log(form.requiresLogin());

पैरामीटर

नामTypeब्यौरा
requireLoginBooleanअगर फ़ॉर्म में उपयोगकर्ताओं को लॉग इन करना ज़रूरी है, तो true; अगर ऐसा नहीं है, तो false.

रिटर्न

Form — मौजूदा फ़ॉर्म (चेनिंग के लिए).

अनुमति देना

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

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

setShowLinkToRespondAgain(enabled)

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

पैरामीटर

नामTypeब्यौरा
enabledBooleantrue, अगर फ़ॉर्म में "दूसरा जवाब सबमिट करें" लिंक दिखना चाहिए; अगर ऐसा नहीं है, तो false.

रिटर्न

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

अनुमति देना

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

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

setShuffleQuestions(shuffle)

सेट करता है कि क्या फ़ॉर्म के हर पेज पर सवालों का क्रम रैंडम किया गया है.

पैरामीटर

नामTypeब्यौरा
shuffleBooleantrue, अगर फ़ॉर्म के हर पेज पर सवालों का क्रम किसी भी क्रम में होना चाहिए; अगर ऐसा नहीं है, तो false.

रिटर्न

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

अनुमति देना

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

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

setTitle(title)

फ़ॉर्म का टाइटल सेट करता है.

पैरामीटर

नामTypeब्यौरा
titleStringफ़ॉर्म का नया टाइटल.

रिटर्न

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

अनुमति देना

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

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

shortenFormUrl(url)

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

पैरामीटर

नामTypeब्यौरा
urlStringछोटा किया जाने वाला यूआरएल.

रिटर्न

String — यूआरएल http://goo.gl/forms/1234 फ़ॉर्मैट में.

अनुमति देना

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

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

submitGrades(responses)

दिए गए formResponses के लिए ग्रेड सबमिट करता है.

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

पैरामीटर

नामTypeब्यौरा
responsesFormResponse[]फ़ॉर्म के सभी जवाबों का कलेक्शन.

रिटर्न

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

अनुमति देना

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

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