نموذج يحتوي على خصائص وعناصر شاملة. وتشمل الخصائص العنوان والإعدادات ومكان تخزين الردود. تشمل العناصر عناصر الأسئلة، مثل مربّعات الاختيار أو عناصر الاختيار، بينما تشير عناصر التنسيق إلى أشياء مثل فواصل الصفحات. يمكن الوصول إلى النماذج أو إنشاؤها من Form.
// Open a form by ID and create a new spreadsheet. const form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); const 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());
الطُرق
| الطريقة | نوع القيمة التي تم إرجاعها | وصف قصير |
|---|---|---|
add | Checkbox | تُلحق هذه السمة عنصر سؤال جديدًا، ويتم عرضه كشبكة من الأعمدة والصفوف، ما يتيح للمستجيب تحديد خيارات متعدّدة لكل صف من سلسلة مربّعات اختيار. |
add | Checkbox | تُلحق هذه الطريقة عنصر سؤال جديدًا يتيح للمستجيب اختيار مربّع اختيار واحد أو أكثر، بالإضافة إلى حقل "غير ذلك" اختياري. |
add | Date | تُلحق عنصر سؤال جديدًا يتيح للمستجيب تحديد تاريخ. |
add | Date | تُلحق هذه الطريقة عنصر سؤال جديدًا يتيح للمستجيب تحديد تاريخ ووقت. |
add | Duration | تُلحق هذه السمة عنصر سؤال جديدًا يتيح للمستجيب تحديد مدة زمنية. |
add | Form | تضيف هذه الطريقة المستخدم المحدّد إلى قائمة المحرّرين في Form. |
add | Form | تضيف هذه الطريقة المستخدم المحدّد إلى قائمة المحرّرين في Form. |
add | Form | تضيف هذه الطريقة مصفوفة المستخدمين المحدّدة إلى قائمة المحرّرين في Form. |
add | Grid | تضيف هذه السمة عنصر سؤال جديدًا، يتم عرضه كشبكة من الأعمدة والصفوف، ويتيح للمستجيب اختيار خيار واحد لكل صف من سلسلة أزرار اختيار. |
add | Image | تُلحق هذه السمة عنصر تخطيط جديدًا يعرض صورة. |
add | List | تُلحق هذه الطريقة عنصر سؤال جديدًا يتيح للمستجيب اختيار خيار واحد من قائمة منسدلة. |
add | Multiple | يضيف عنصر سؤال جديدًا يتيح للمستجيب اختيار خيار واحد من قائمة أزرار اختيار أو حقل "غير ذلك" اختياري. |
add | Page | تضيف هذه السمة عنصر تخطيط جديدًا يحدّد بداية الصفحة. |
add | Paragraph | تضيف هذه السمة عنصر سؤال جديدًا يتيح للمستجيب إدخال فقرة نصية. |
add | Form | تضيف هذه الطريقة المستخدم المحدّد إلى قائمة المستجيبين لـ Form. |
add | Form | تضيف هذه الطريقة المستخدم المحدّد إلى قائمة المستجيبين لـ Form. |
add | Form | تضيف هذه الطريقة مصفوفة المستخدمين المحدّدة إلى قائمة المستجيبين لـ Form. |
add | Rating | تضيف هذه الطريقة عنصر سؤال جديدًا يتيح للمجيب تقديم تقييم. |
add | Scale | تُلحق هذه الطريقة عنصر سؤال جديدًا يتيح للمستجيب اختيار خيار واحد من تسلسل مرقّم من أزرار الاختيار. |
add | Section | تُلحق هذه السمة عنصر تخطيط جديدًا يشير بصريًا إلى بداية قسم. |
add | Text | تُلحق هذه الطريقة عنصر سؤال جديدًا يتيح للمستجيب إدخال سطر واحد من النص. |
add | Time | تضيف هذه السمة عنصر سؤال جديدًا يتيح للمستجيب تحديد وقت من اليوم. |
add | Video | تضيف هذه السمة عنصر تخطيط جديدًا يعرض فيديو. |
can | Boolean | تحدّد ما إذا كان النموذج يعرض رابطًا لتعديل الردّ بعد إرساله. |
collects | Boolean | تحدّد ما إذا كان النموذج يجمع عناوين البريد الإلكتروني للمستجيبين. |
create | Form | تنشئ هذه الطريقة ردًا جديدًا على النموذج. |
delete | Form | يحذف هذا الإجراء جميع الردود المُرسَلة من مستودع الردود في النموذج. |
delete | void | لحذف العنصر في فهرس معيّن من بين جميع العناصر في النموذج |
delete | void | يحذف العنصر المحدّد. |
delete | Form | يحذف هذا الإجراء ردًا واحدًا من مستودع الردود في النموذج. |
get | String | تعرض هذه السمة رسالة تأكيد النموذج. |
get | String | تعرض هذه الطريقة الرسالة المخصّصة التي تظهر إذا كان النموذج لا يقبل الردود، أو تعرض سلسلة فارغة إذا لم يتم ضبط أي رسالة مخصّصة. |
get | String | تعرض هذه السمة وصف النموذج. |
get | String | تعرض هذه الطريقة رقم تعريف وجهة الردود على النموذج. |
get | Destination | تعرض هذه الطريقة نوع وجهة الردّ في النموذج. |
get | String | تعرض هذه الدالة عنوان URL الذي يمكن استخدامه للوصول إلى وضع تعديل النموذج. |
get | User[] | تعرض هذه الطريقة قائمة بالمحرّرين لـ Form. |
get | String | تعرض هذه الدالة رقم تعريف النموذج. |
get | Item|null | تعرض هذه الطريقة السلعة التي تحمل رقم تعريف معيّنًا. |
get | Item[] | تعرض هذه الطريقة مصفوفة تتضمّن جميع العناصر في النموذج. |
get | Item[] | تعرض هذه الطريقة صفيفًا يتضمّن جميع العناصر من نوع معيّن. |
get | User[] | تعرض هذه الطريقة قائمة المجيبين عن Form. |
get | String | تعرض هذه الدالة عنوان URL الذي يمكن استخدامه للردّ على النموذج. |
get | Form | يحصل على ردّ واحد على النموذج استنادًا إلى رقم تعريف الردّ. |
get | Form | تعرض هذه الطريقة مصفوفة تتضمّن جميع الردود على النموذج. |
get | Form | تعرض هذه الدالة مصفوفة تتضمّن جميع ردود النموذج بعد تاريخ ووقت محدّدَين. |
get | Boolean | تحدّد هذه السمة ما إذا كان ترتيب الأسئلة على كل صفحة من النموذج عشوائيًا. |
get | String | تعرض هذه الدالة عنوان URL الذي يمكن استخدامه لعرض ملخّص لردود النموذج. |
get | String | تعرض هذه الدالة عنوان النموذج. |
has | Boolean | تحدِّد ما إذا كان النموذج يسمح بردّ واحد فقط لكل مستجيب. |
has | Boolean | تحدّد هذه السمة ما إذا كان النموذج يعرض شريط تقدّم. |
has | Boolean | تحدّد ما إذا كان النموذج يعرض رابطًا لإرسال رد آخر بعد أن يكمل المجيب النموذج. |
is | Boolean | تحدّد ما إذا كان النموذج يقبل الردود حاليًا. |
is | Boolean | تحدّد هذه السمة ما إذا كان النموذج منشورًا. |
is | Boolean | تحدّد ما إذا كان النموذج يعرض رابطًا للاطّلاع على ملخّص الردود بعد أن يكمل المجيب النموذج. |
is | Boolean | تحدّد ما إذا كان النموذج اختبارًا. |
move | Item | تنقل هذه الدالة عنصرًا في فهرس معيّن بين جميع العناصر في النموذج إلى فهرس آخر معيّن. |
move | Item | تنقل هذه السمة عنصرًا معيّنًا إلى فهرس معيّن بين جميع العناصر في النموذج. |
remove | Form | لإلغاء ربط النموذج بوجهة الرد الحالية |
remove | Form | تزيل هذه السمة المستخدم المحدّد من قائمة المحرّرين في Form. |
remove | Form | تزيل هذه السمة المستخدم المحدّد من قائمة المحرّرين في Form. |
remove | Form | يزيل هذا الإجراء المستخدم المحدّد من قائمة المستجيبين لـ Form. |
remove | Form | يزيل هذا الإجراء المستخدم المحدّد من قائمة المستجيبين لـ Form. |
set | Form | تضبط هذه السمة ما إذا كان النموذج يقبل الردود حاليًا. |
set | Form | تضبط ما إذا كان النموذج يعرض رابطًا لتعديل الرد بعد إرساله. |
set | Form | تضبط هذه السمة ما إذا كان النموذج يجمع عناوين البريد الإلكتروني للمستجيبين. |
set | Form | تضبط هذه السمة رسالة تأكيد النموذج. |
set | Form | تضبط هذه السمة الرسالة التي سيتم عرضها إذا كان النموذج لا يقبل الردود. |
set | Form | تضبط هذه السمة وصف النموذج. |
set | Form | تضبط هذه السمة الوجهة التي يتم فيها حفظ ردود النموذج. |
set | Form | تضبط هذه السمة ما إذا كان النموذج اختبارًا. |
set | Form | تضبط هذه السمة ما إذا كان النموذج يسمح بردّ واحد فقط لكل مجيب. |
set | Form | تضبط هذه السمة ما إذا كان النموذج يتضمّن شريط تقدّم. |
set | Form | تضبط هذه السمة ما إذا كان النموذج منشورًا. |
set | Form | تحدّد ما إذا كان النموذج يعرض رابطًا للاطّلاع على ملخّص الردود بعد أن يرسل المجيب النموذج. |
set | Form | تحدّد ما إذا كان النموذج يعرض رابطًا لإرسال رد آخر بعد أن يكمل المستجيب النموذج. |
set | Form | تحدّد هذه السمة ما إذا كان ترتيب الأسئلة في كل صفحة من النموذج عشوائيًا. |
set | Form | تضبط هذه السمة عنوان النموذج. |
shorten | String | تحويل عنوان URL طويل خاص بنموذج إلى عنوان URL قصير |
submit | Form | يرسل الدرجات لردود النماذج المحدّدة. |
supports | Boolean | تحدِّد هذه السمة ما إذا كان النموذج يتيح النشر. |
مستندات تفصيلية
add Checkbox Grid 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', ); // Adds a checkbox grid item. const item = form.addCheckboxGridItem(); 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' ]);
الإرجاع
Checkbox: العنصر الذي تم إنشاؤه حديثًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Checkbox 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', ); // 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']);
الإرجاع
Checkbox: العنصر الذي تم إنشاؤه حديثًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Date 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', ); // 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.');
الإرجاع
Date: العنصر الذي تم إنشاؤه حديثًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Date Time 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', ); // 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);
الإرجاع
Date: العنصر الذي تم إنشاؤه حديثًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Duration 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', ); // 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);
الإرجاع
Duration: العنصر الذي تم إنشاؤه حديثًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Editor(emailAddress)
تضيف هذه الطريقة المستخدم المحدّد إلى قائمة المحرّرين في Form. إذا كان المستخدم مُدرَجًا في قائمة المشاهدين أو المجيبين، ستؤدي هذه الطريقة إلى إزالة المستخدم من القائمة.
// 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 editor to the form. // TODO(developer): replace the emailAddress. form.addEditor('editor@uni.edu');
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
email | String | عنوان البريد الإلكتروني للمستخدم الذي تريد إضافته |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Editor(user)
تضيف هذه الطريقة المستخدم المحدّد إلى قائمة المحرّرين في Form. إذا كان المستخدم مُدرَجًا في قائمة المشاهدين أو المجيبين، ستؤدي هذه الطريقة إلى إزالة المستخدم من القائمة.
// Opens the Forms file by its URL. // TODO(developer): Replace the URL with your own. const oldForm = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Gets the editors from the old form. const users = oldForm.getEditors(); // Creates a new form. const newForm = FormApp.create('New form'); // Adds the editors to a new form. users.forEach(user => newForm.addEditor(user));
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
user | User | تمثيل للمستخدم الذي تريد إضافته |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Editors(emailAddresses)
تضيف هذه الطريقة مصفوفة المستخدمين المحدّدة إلى قائمة المحرّرين في Form. إذا كان أي من المستخدمين
مدرجًا في قائمة المشاهدين، يرفع هذا الإجراء مستوى المستخدمين خارج قائمة المشاهدين.
// 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 editors to the form. // TODO(developer): replace the emailAddress. form.addPublishedReaders(['editor1@uni.edu', 'editor2@uni.edu']);
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
email | String[] | مصفوفة من عناوين البريد الإلكتروني للمستخدمين الذين تريد إضافتهم |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Grid 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', ); // 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' ]);
الإرجاع
Grid: العنصر الذي تم إنشاؤه حديثًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Image 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', ); // 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);
الإرجاع
Image: العنصر الذي تم إنشاؤه حديثًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add List 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', ); // 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')]);
الإرجاع
List: العنصر الذي تم إنشاؤه حديثًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Multiple Choice 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', ); // 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]);
الإرجاع
Multiple: العنصر الذي تم إنشاؤه حديثًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Page Break 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', ); // 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);
الإرجاع
Page: العنصر الذي تم إنشاؤه حديثًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Paragraph Text Item()
تضيف هذه السمة عنصر سؤال جديدًا يتيح للمستجيب إدخال فقرة نصية.
// 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?');
الإرجاع
Paragraph: العنصر الذي تم إنشاؤه حديثًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Published Reader(emailAddress)
تضيف هذه الطريقة المستخدم المحدّد إلى قائمة المستجيبين لـ Form. إذا كان المستخدم مُدرجًا في قائمة المحرّرين أو المشاهدين، لن يكون لهذا الإجراء أي تأثير.
// 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 responder to the form. // TODO(developer): replace the emailAddress. form.addPublishedReader('responder@uni.edu');
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
email | String | عنوان البريد الإلكتروني للمستخدم الذي تريد إضافته |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Published Reader(user)
تضيف هذه الطريقة المستخدم المحدّد إلى قائمة المستجيبين لـ Form. إذا كان المستخدم مُدرجًا في قائمة المحرّرين أو المشاهدين، لن يكون لهذا الإجراء أي تأثير.
// Opens the Forms file by its URL. // TODO(developer): Replace the URL with your own. const oldForm = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Gets the responders from the old form. const users = oldForm.getPublishedReaders(); // Creates a new form. const newForm = FormApp.create('New form'); // Adds the responders to a new form. users.forEach(user => newForm.addPublishedReader(user));
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
user | User | تمثيل للمستخدم الذي تريد إضافته |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Published Readers(emailAddresses)
تضيف هذه الطريقة مصفوفة المستخدمين المحدّدة إلى قائمة المستجيبين لـ Form. إذا كان المستخدم
مدرجًا في قائمة المحرّرين أو المشاهدين، لن يكون لهذا الإجراء أي تأثير.
// 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 responders to the form. // TODO(developer): replace the emailAddress. form.addPublishedReaders(['responder1@uni.edu', 'responder2@uni.edu']);
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
email | String[] | مصفوفة من عناوين البريد الإلكتروني للمستخدمين الذين تريد إضافتهم |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Rating 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', ); // Adds the rating item. const item = form.addRatingItem();
الإرجاع
Rating: العنصر الذي تم إنشاؤه حديثًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Scale 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', ); // 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');
الإرجاع
Scale: العنصر الذي تم إنشاؤه حديثًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Section Header 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', ); // 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');
الإرجاع
Section: العنصر الذي تم إنشاؤه حديثًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Text 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', ); // Adds a single-line text item. const item = form.addTextItem(); // Sets the title to 'What is your name?' item.setTitle('What is your name?');
الإرجاع
Text: العنصر الذي تم إنشاؤه حديثًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Time 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', ); // 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?');
الإرجاع
Time: العنصر الذي تم إنشاؤه حديثًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
add Video 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', ); // 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);
الإرجاع
Video: العنصر الذي تم إنشاؤه حديثًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
can Edit Response()
تحدّد ما إذا كان النموذج يعرض رابطًا لتعديل الردّ بعد إرساله.
بغض النظر عن هذا الإعداد، تسمح الطريقة Form لمؤلف البرنامج النصي الذي لديه إذن تعديل النموذج بإنشاء عنوان URL يمكن استخدامه لتعديل رد.
// 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);
الإرجاع
Boolean — true إذا كان النموذج يعرض الرابط "تعديل ردك"، false إذا كان لا يعرضه.
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
collects Email()
تحدّد ما إذا كان النموذج يجمع عناوين البريد الإلكتروني للمستجيبين.
// 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
create Response()
تنشئ هذه الطريقة ردًا جديدًا على النموذج. للإجابة عن عنصر سؤال، أنشئ Item
من العنصر، ثم أرفِقه بردّ النموذج هذا من خلال استدعاء Form. لحفظ الردّ المجمّع، اتّصِل بالرقم Form.
الإرجاع
Form: الردّ الذي تم إنشاؤه حديثًا على النموذج
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
delete All Responses()
يحذف هذا الإجراء جميع الردود المُرسَلة من مستودع الردود في النموذج. لا تؤدي هذه الطريقة إلى حذف نُسخ الردود المخزّنة في وجهة ردود خارجية (مثل جدول بيانات)، ولكنها تؤدي إلى محو عرض الملخّص للنموذج.
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
delete Item(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); }
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
index | Integer | فهرس العنصر بين جميع العناصر في النموذج |
عمليات الطرح
Error: إذا لم يكن هناك عنصر في الفهرس المحدّد
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
delete Item(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); }
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
item | Item | العنصر المطلوب حذفه |
عمليات الطرح
Error: إذا لم يكن العنصر متوفّرًا في النموذج
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
delete Response(responseId)
يحذف هذا الإجراء ردًا واحدًا من مستودع الردود في النموذج. لا تحذف هذه الطريقة نُسخ الردود المخزّنة في وجهة ردود خارجية (مثل جدول بيانات)، ولكنها تزيل الرد من عرض الملخّص للنموذج. يمكن استرداد رقم تعريف الردّ باستخدام Form.
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
response | String | رقم تعريف الردّ على النموذج المطلوب حذفه |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Confirmation 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 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
get Custom Closed Form 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 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
get Description()
تعرض هذه السمة وصف النموذج.
// 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
get Destination Id()
تعرض هذه الطريقة رقم تعريف وجهة الردود على النموذج.
// 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
get Destination Type()
تعرض هذه الطريقة نوع وجهة الردّ في النموذج.
// 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);
الإرجاع
Destination: نوع وجهة الردّ على النموذج.
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Edit Url()
تعرض هذه الطريقة عنوان URL الذي يمكن استخدامه للوصول إلى وضع تعديل النموذج.
// 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: عنوان URL لتعديل النموذج
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Editors()
تعرض هذه الطريقة قائمة بالمحرّرين لـ Form.
الإرجاع
User[]: مصفوفة من المستخدمين الذين لديهم إذن التعديل
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Id()
تعرض هذه الدالة رقم تعريف النموذج.
// 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
get Item By Id(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);
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
id | Integer | معرّف السلعة. |
الإرجاع
Item|null: العنصر الذي يحمل رقم التعريف المحدّد، أو null إذا لم يكن العنصر متوفّرًا في النموذج.
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Items()
تعرض هذه الطريقة مصفوفة تتضمّن جميع العناصر في النموذج.
// 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
get Items(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);
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
item | Item | نوع العناصر المطلوب استردادها. |
الإرجاع
Item[]: مصفوفة تتضمّن جميع العناصر من هذا النوع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Published Readers()
تعرض هذه الطريقة قائمة المجيبين عن Form.
// 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 responders for the form. const users = form.getPublishedReaders(); users.forEach(user => console.log(user.getEmail()));
الإرجاع
User[]: مصفوفة من المستخدمين الذين لديهم إذن الردّ
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Published Url()
تعرض هذه الدالة عنوان URL الذي يمكن استخدامه للردّ على النموذج.
// 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: عنوان URL للردّ على النموذج
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Response(responseId)
يحصل على ردّ واحد على النموذج استنادًا إلى رقم تعريف الردّ. يمكن استرداد أرقام تعريف الردود من Form.
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
response | String | رقم تعريف الردّ على النموذج |
الإرجاع
Form: الردّ على النموذج
عمليات الطرح
Error: إذا لم يكن الردّ متوفّرًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Responses()
تعرض هذه الطريقة مصفوفة تتضمّن جميع الردود على النموذج.
الإرجاع
Form: مصفوفة تتضمّن جميع الردود على النموذج.
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Responses(timestamp)
تعرض هذه الدالة مصفوفة تتضمّن جميع ردود النموذج بعد تاريخ ووقت محدّدَين.
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
timestamp | Date | أبكر تاريخ ووقت يجب عرض ردود النموذج فيهما |
الإرجاع
Form: قائمة الردود على النموذج
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Shuffle Questions()
تحدّد هذه السمة ما إذا كان ترتيب الأسئلة على كل صفحة من النموذج عشوائيًا.
الإرجاع
Boolean — true إذا كان ترتيب الأسئلة على كل صفحة من النموذج عشوائيًا،
false إذا لم يكن كذلك.
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Summary Url()
تعرض هذه الدالة عنوان URL الذي يمكن استخدامه لعرض ملخّص لردود النموذج. ما لم يتم ضبط set على true، لن يتمكّن من الوصول إلى عنوان URL سوى المستخدمين الذين لديهم إذن بتعديل النموذج.
// 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: عنوان URL للاطّلاع على ملخّص الردود.
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Title()
تعرض هذه الدالة عنوان النموذج.
// 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
has Limit One Response Per User()
تحدِّد ما إذا كان النموذج يسمح بردّ واحد فقط لكل مستجيب. إذا كانت القيمة true، لا يمكن للبرنامج النصي إرسال ردود النموذج على الإطلاق.
الإرجاع
Boolean: true إذا كان النموذج يسمح برد واحد فقط لكل مجيب، false إذا لم يكن كذلك.
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
has Progress Bar()
تحدّد هذه السمة ما إذا كان النموذج يعرض شريط تقدّم.
// 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());
الإرجاع
Boolean: true إذا كان النموذج يعرض شريط تقدّم، false إذا كان لا يعرضه
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
has Respond Again Link()
تحدّد ما إذا كان النموذج يعرض رابطًا لإرسال رد آخر بعد أن يكمل المجيب النموذج.
// 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());
الإرجاع
Boolean — true إذا كان النموذج يعرض الرابط "إرسال رد آخر"، false إذا لم يكن يعرضه.
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
is Accepting Responses()
تحدّد ما إذا كان النموذج يقبل الردود حاليًا. يتم استبدال هذه القيمة عند تغيير حالة نشر النموذج.
// 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);
الإرجاع
Boolean: true إذا كان النموذج يقبل الردود، false إذا كان لا يقبلها
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
is Published()
تحدّد هذه السمة ما إذا كان النموذج منشورًا.
تتوفّر هذه الميزة فقط للنماذج التي تتيح النشر. استخدِم supports للتحقّق مما إذا كان النموذج يتيح النشر.
// 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 whether the form is published or not and logs it to the console. console.log(form.isPublished());
الإرجاع
Boolean: true إذا تم نشر النموذج، false إذا لم يتم نشره
عمليات الطرح
Error: إذا تم استدعاؤها في نماذج غير متوافقة
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
is Publishing Summary()
تحدّد ما إذا كان النموذج يعرض رابطًا للاطّلاع على ملخّص الردود بعد أن يكمل المجيب النموذج.
// 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);
الإرجاع
Boolean — true إذا كان النموذج يعرض الرابط "عرض الردود السابقة"، false إذا لم يكن يعرضه.
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
is Quiz()
تحدّد ما إذا كان النموذج اختبارًا.
// 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());
الإرجاع
Boolean: true إذا كان النموذج يقبل الردود، false إذا كان لا يقبلها
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
move Item(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);
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
from | Integer | الفهرس الحالي للعنصر بين جميع العناصر في النموذج |
to | Integer | الفهرس الجديد للعنصر بين جميع العناصر في النموذج |
الإرجاع
Item: العنصر الذي تم نقله
عمليات الطرح
Error: إذا كان أي من الفهرسين خارج الحدود.
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
move Item(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);
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
item | Item | العنصر المطلوب نقله |
to | Integer | الفهرس الجديد للعنصر بين جميع العناصر في النموذج |
الإرجاع
Item: العنصر الذي تم نقله
عمليات الطرح
Error: إذا كان الفهرس خارج الحدود.
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
remove Destination()
لإلغاء ربط النموذج بوجهة الرد الحالية ستظل الوجهة السابقة غير المرتبطة تحتفظ بنسخة من جميع الردود السابقة. تحفظ جميع النماذج، بما في ذلك تلك التي لم يتم تحديد وجهة لها بشكل صريح، نسخة من الردود في مستودع الردود الخاص بالنموذج. في حال عدم توفّر وجهة رد في النموذج حاليًا، لن يكون لهذه الطريقة أي تأثير.
// 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();
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
remove Editor(emailAddress)
تزيل هذه السمة المستخدم المحدّد من قائمة المحرّرين في Form. لا تمنع هذه الطريقة المستخدمين من الوصول إلى Form إذا كانوا ينتمون إلى فئة من المستخدمين لديهم إذن عام بالوصول، مثلاً إذا تمت مشاركة Form مع النطاق الكامل للمستخدم، أو إذا كان Form في مساحة تخزين سحابي مشتركة يمكن للمستخدم الوصول إليها.
بالنسبة إلى ملفات Drive، يؤدي ذلك أيضًا إلى إزالة المستخدم من قائمة المشاهدين والمستجيبين.
// Opens the Forms file by its URL. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Removes the editor from the form. // TODO(developer): replace the emailAddress. form.removeEditor('editor@uni.edu');
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
email | String | عنوان البريد الإلكتروني للمستخدم الذي تريد إزالته |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
remove Editor(user)
تزيل هذه السمة المستخدم المحدّد من قائمة المحرّرين في Form. لا تمنع هذه الطريقة المستخدمين من الوصول إلى Form إذا كانوا ينتمون إلى فئة من المستخدمين لديهم إذن عام بالوصول، مثلاً إذا تمت مشاركة Form مع النطاق الكامل للمستخدم، أو إذا كان Form في مساحة تخزين سحابي مشتركة يمكن للمستخدم الوصول إليها.
بالنسبة إلى ملفات Drive، تؤدي هذه العملية أيضًا إلى إزالة المستخدم من قائمة المشاهدين.
// Opens the Forms file by its URL. // TODO(developer): Replace the URL with your own. const form1 = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Gets the editors from the form. const users = form1.getEditors(); // Opens another form. // TODO(developer): Replace the URL with your own. const form2 = FormApp.openByUrl('https://docs.google.com/forms/d/efg123456/edit'); // Removes editors from the form. users.forEach(user => form2.removeEditor(user));
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
user | User | تمثيل للمستخدم المطلوب إزالته |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
remove Published Reader(emailAddress)
يزيل هذا الإجراء المستخدم المحدّد من قائمة المستجيبين لـ Form. لا تمنع هذه الطريقة المستخدمين من الوصول إلى Form إذا كانوا ينتمون إلى فئة من المستخدمين لديهم إذن وصول عام، مثلاً، إذا تمت مشاركة Form مع النطاق الكامل للمستخدم، أو إذا كان Form في مساحة تخزين سحابي مشتركة يمكن للمستخدم الوصول إليها.
بالنسبة إلى ملفات Drive، يؤدي ذلك أيضًا إلى إزالة المستخدم من قائمة المشاهدين والمحرّرين.
// Opens the Forms file by its URL. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Removes the responders from the form. // TODO(developer): replace the emailAddress. form.removePublishedReader('responder1@uni.edu');
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
email | String | عنوان البريد الإلكتروني للمستخدم الذي تريد إزالته |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
remove Published Reader(user)
يزيل هذا الإجراء المستخدم المحدّد من قائمة المستجيبين لـ Form. لا تمنع هذه الطريقة المستخدمين من الوصول إلى Form إذا كانوا ينتمون إلى فئة من المستخدمين لديهم إذن وصول عام، مثلاً، إذا تمت مشاركة Form مع النطاق الكامل للمستخدم، أو إذا كان Form في مساحة تخزين سحابي مشتركة يمكن للمستخدم الوصول إليها.
بالنسبة إلى ملفات Drive، يؤدي ذلك أيضًا إلى إزالة المستخدم من قائمة المشاهدين والمحرّرين.
// Opens the Forms file by its URL. // TODO(developer): Replace the URL with your own. const form1 = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Gets the responders from the form. const users = form1.getPublishedReaders(); // Opens another form. // TODO(developer): Replace the URL with your own. const form2 = FormApp.openByUrl('https://docs.google.com/forms/d/efg123456/edit'); // Removes responders from the form. users.forEach(user => form2.removePublishedReader(user));
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
user | User | تمثيل للمستخدم المطلوب إزالته |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Accepting Responses(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());
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
enabled | Boolean | true إذا كان النموذج سيقبل الردود، false إذا كان لن يقبلها |
الإرجاع
عمليات الطرح
Error: إذا كانت مفعَّلة في نموذج غير منشور
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Allow Response Edits(enabled)
تضبط ما إذا كان النموذج يعرض رابطًا لتعديل الرد بعد إرساله. القيمة التلقائية للنماذج الجديدة هي false.
بغض النظر عن هذا الإعداد، تسمح الطريقة Form لمؤلف البرنامج النصي الذي لديه إذن تعديل النموذج بإنشاء عنوان URL يمكن استخدامه لتعديل رد.
// 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());
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
enabled | Boolean | true إذا كان النموذج سيعرض رابط "تعديل ردّك"، false إذا لم يكن كذلك. |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Collect Email(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);
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
collect | Boolean | true إذا كان النموذج سيجمع عناوين البريد الإلكتروني، false إذا لم يكن كذلك. |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Confirmation Message(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);
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
message | String | رسالة التأكيد الجديدة للنموذج |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Custom Closed Form Message(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);
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
message | String | الرسالة التي سيتم عرضها إذا كان النموذج لا يقبل الردود. |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Description(description)
تضبط هذه السمة وصف النموذج.
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
description | String | الوصف الجديد للنموذج. |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Destination(type, id)
تضبط هذه السمة الوجهة التي يتم فيها حفظ ردود النموذج. تحفظ جميع النماذج، بما في ذلك تلك التي لم يتم ضبط وجهة لها بشكل صريح، نسخة من الردود في مستودع الردود الخاص بالنموذج.
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
type | Destination | نوع وجهة الردّ على النموذج |
id | String | رقم تعريف وجهة الردود على النموذج |
الإرجاع
عمليات الطرح
Error: إذا كان معرّف الوجهة المحدّد غير صالح
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Is Quiz(enabled)
تضبط هذه السمة ما إذا كان النموذج اختبارًا. القيمة التلقائية للنماذج الجديدة هي false.
لا يُسمح بالأسئلة التي تتضمّن درجات إلا في "الاختبارات"، لذا سيؤدي ضبط هذا الخيار على false إلى إزالة جميع خيارات وضع الدرجات من جميع الأسئلة.
لا تتوفّر إعدادات الاختبار إلا في واجهة مستخدم "نماذج 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', ); // 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());
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
enabled | Boolean | true إذا كان يجب تفعيل ميزات الاختبار في النموذج، false إذا لم يكن يجب ذلك. |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Limit One Response Per User(enabled)
تضبط هذه السمة ما إذا كان النموذج يسمح بردّ واحد فقط لكل مجيب. القيمة التلقائية للنماذج الجديدة هي false. في حال ضبط القيمة على true، لن يتمكّن النص البرمجي من إرسال ردود النموذج على الإطلاق.
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
enabled | Boolean | true إذا كان النموذج يجب أن يسمح برد واحد فقط لكل مجيب، false إذا لم يكن كذلك |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Progress Bar(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());
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
enabled | Boolean | true إذا كان النموذج يعرض شريط تقدّم، false إذا لم يكن يعرضه |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Published(enabled)
تضبط هذه السمة ما إذا كان النموذج منشورًا. القيمة التلقائية للنماذج الجديدة هي true.
تتوفّر هذه الميزة فقط للنماذج التي تتيح النشر. استخدِم supports للتحقّق مما إذا كان النموذج يتيح النشر.
يجب نشر النموذج ليتمكّن المجيبون من الوصول إليه. يحلّ هذا الإجراء محلّ
عمليات استدعاء set.
// 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', ); // Publishes the form before sharing it. form.setPublished(true); // Checks whether the form is published or not and logs it to the console. console.log(form.isPublished());
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
enabled | Boolean | true إذا كان يجب نشر النموذج، false إذا لم يكن كذلك. |
الإرجاع
عمليات الطرح
Error: إذا تم استدعاؤها في نماذج غير متوافقة
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Publishing Summary(enabled)
تحدّد ما إذا كان النموذج يعرض رابطًا للاطّلاع على ملخّص الردود بعد أن يرسل المجيب النموذج. القيمة التلقائية للنماذج الجديدة هي false.
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
enabled | Boolean | true إذا كان النموذج سيعرض الرابط "عرض الردود السابقة"، false إذا لم يكن سيعرضه |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Show Link To Respond Again(enabled)
تحدّد ما إذا كان النموذج يعرض رابطًا لإرسال رد آخر بعد أن يكمل المستجيب النموذج. القيمة التلقائية للنماذج الجديدة هي true.
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
enabled | Boolean | true إذا كان النموذج سيعرض الرابط "إرسال رد آخر"، false إذا لم يكن كذلك |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Shuffle Questions(shuffle)
تحدّد هذه السمة ما إذا كان ترتيب الأسئلة في كل صفحة من النموذج عشوائيًا.
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
shuffle | Boolean | true إذا كان يجب ترتيب الأسئلة بشكل عشوائي على كل صفحة من صفحات النموذج، false إذا لم يكن كذلك. |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Title(title)
تضبط هذه السمة عنوان النموذج.
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
title | String | تمثّل هذه السمة العنوان الجديد للنموذج. |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
shorten Form Url(url)
تحويل عنوان URL طويل خاص بنموذج إلى عنوان URL قصير يُنشئ هذا الإجراء استثناءً إذا كان عنوان URL الطويل لا ينتمي إلى "نماذج Google".
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
url | String | تمثّل هذه السمة عنوان URL المطلوب اختصاره. |
الإرجاع
String: عنوان URL بالتنسيق http://goo.gl/forms/1234
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
submit Grades(responses)
يرسل الدرجات لردود النماذج المحدّدة.
إذا كان الرمز يتضمّن مشغّلاً on، سيؤدي استدعاء submit
إلى تشغيل شرط on والتسبّب في حدوث حلقة لا نهائية. لمنع حدوث حلقة لا نهائية، أضِف رمزًا برمجيًا يتحقّق مما إذا كانت الدرجات متوفّرة قبل استدعاء submit.
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
responses | Form | مصفوفة تتضمّن جميع الردود على النموذج |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
supports Advanced Responder Permissions()
تحدِّد هذه السمة ما إذا كان النموذج يتيح النشر. تُستخدَم هذه الطريقة لتحديد ما إذا كانت الطريقتان set وis وأذونات المستجيب متوفّرة.
// 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 whether the form supports publishing or not and logs it to the // console. console.log(form.supportsAdvancedResponderPermissions());
الإرجاع
Boolean — true إذا كان النموذج يتيح النشر، وfalse إذا كان لا يتيح ذلك.
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms