טופס שמכיל מאפיינים ופריטים כלליים. המאפיינים כוללים את השם, ההגדרות והמקום שבו התשובות מאוחסנות. הפריטים כוללים פריטי שאלות כמו תיבות סימון או פריטי בחירה, בעוד שפריטי פריסה מתייחסים לדברים כמו מעברי דפים. אפשר לגשת לטפסים או ליצור אותם מ-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());
Methods
| שיטה | סוג הערך שמוחזר | תיאור קצר |
|---|---|---|
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 | האינדקס של הפריט מבין כל הפריטים בטופס. |
מקפיצה את הודעות השגיאה (Throws)
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 | הפריט שרוצים למחוק. |
מקפיצה את הודעות השגיאה (Throws)
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()
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 — התשובה לטופס.
מקפיצה את הודעות השגיאה (Throws)
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 אם הוא לא פורסם.
מקפיצה את הודעות השגיאה (Throws)
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 — הפריט שהועבר.
מקפיצה את הודעות השגיאה (Throws)
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 — הפריט שהועבר.
מקפיצה את הודעות השגיאה (Throws)
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 אם הוא לא צריך לקבל תשובות. |
חזרה
מקפיצה את הודעות השגיאה (Throws)
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)
set Destination(type, id)
ההגדרה הזו קובעת את היעד שבו נשמרות התשובות לטופס. כל הטפסים, כולל אלה שלא הוגדר להם יעד באופן מפורש, שומרים עותק של התגובות במאגר התגובות של הטופס.
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
type | Destination | סוג היעד של התשובות לטופס. |
id | String | המזהה של יעד התשובות של הטופס. |
חזרה
מקפיצה את הודעות השגיאה (Throws)
Error — אם מזהה היעד שצוין לא תקין
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Is Quiz(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());
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
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 אם לא. |
חזרה
מקפיצה את הודעות השגיאה (Throws)
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)
shorten Form Url(url)
ממירה כתובת URL ארוכה של טופס לכתובת URL קצרה. מוחזרת חריגה אם כתובת ה-URL הארוכה לא שייכת ל-Google Forms.
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
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