טופס שמכיל מאפיינים ופריטים כלליים. המאפיינים כוללים את השם, ההגדרות והמקום שבו התשובות מאוחסנות. הפריטים כוללים פריטי שאלות כמו תיבות סימון או פריטי בחירה, בעוד שפריטי פריסה מתייחסים לדברים כמו מעברי דף. אפשר לגשת לטפסים או ליצור אותם מ-FormApp.
// 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 | קובעת אם הטופס תומך בפרסום. |
תיעוד מפורט
addCheckboxGridItem()
הפונקציה מוסיפה פריט שאלה חדש, שמוצג כרשת של עמודות ושורות, ומאפשרת למשיב לבחור כמה תשובות לכל שורה מתוך רצף של תיבות סימון.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Adds a checkbox grid item. const item = form.addCheckboxGridItem(); item.setTitle('Where did you celebrate New Year\'s?'); // Sets the grid's rows and columns. item.setRows(['New York', 'San Francisco', 'London']).setColumns([ '2014', '2015', '2016', '2017' ]);
חזרה
CheckboxGridItem – הפריט שנוצר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addCheckboxItem()
מוסיף פריט שאלה חדש שמאפשר למשיב לסמן תיבת סימון אחת או יותר, וגם שדה אופציונלי של 'אחר'.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Adds a checkbox item. const item = form.addCheckboxItem(); // Sets the title of the checkbox item to 'Do you prefer cats or dogs?' item.setTitle('Do you prefer cats or dogs?'); // Sets the choices. item.setChoiceValues(['Cats', 'Dogs']);
חזרה
CheckboxItem – הפריט שנוצר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addDateItem()
מוסיפה פריט חדש של שאלה שמאפשר למשיב לציין תאריך.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Adds a date item. const item = form.addDateItem(); // Sets the title to 'When were you born?' item.setTitle('When were you born?'); // Sets the description for the date item. item.setHelpText('Some helper text.');
חזרה
DateItem – הפריט שנוצר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addDateTimeItem()
מוסיפה פריט שאלה חדש שמאפשר למשיב לציין תאריך ושעה.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Adds a question with date and time inputs. const item = form.addDateTimeItem(); // Sets the title to 'When were you born?' item.setTitle('When were you born?'); // Sets the question as required. item.setRequired(true);
חזרה
DateTimeItem – הפריט שנוצר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addDurationItem()
מוסיפה פריט שאלה חדש שמאפשר למשיב לציין משך זמן.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Adds a question with a duration input. const item = form.addDurationItem(); // Sets the title to 'How long can you hold your breath?' item.setTitle('How long can you hold your breath?'); // Sets the question as required. item.setRequired(true);
חזרה
DurationItem – הפריט שנוצר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addEditor(emailAddress)
הפונקציה מוסיפה את המשתמש שצוין לרשימת העורכים של Form. אם המשתמש כבר היה ברשימת הצופים או המשיבים, השיטה הזו מוציאה את המשתמש מהרשימה.
// 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
addEditor(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
addEditors(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
addGridItem()
הפונקציה מוסיפה פריט שאלה חדש שמוצג כרשת של עמודות ושורות, ומאפשרת למשיב לבחור אפשרות אחת לכל שורה מתוך רצף של כפתורי בחירה.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Adds a multiple choice grid. const item = form.addGridItem(); // Sets the title to 'Rate your interests.' item.setTitle('Rate your interests'); // Sets the grid's rows and columns. item.setRows(['Cars', 'Computers', 'Celebrities']).setColumns([ 'Boring', 'So-so', 'Interesting' ]);
חזרה
GridItem – הפריט שנוצר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addImageItem()
מוסיף פריט פריסה חדש שמציג תמונה.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Adds an image item. const item = form.addImageItem(); // Gets the Google icon to use as the image. const img = UrlFetchApp.fetch( 'https://fonts.gstatic.com/s/i/productlogos/googleg/v6/web-24dp/logo_googleg_color_1x_web_24dp.png', ); // Sets the image, title, and description for the item. item.setTitle('Google icon').setHelpText('Google icon').setImage(img);
חזרה
ImageItem – הפריט שנוצר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addListItem()
מוסיף פריט שאלה חדש שמאפשר למשיב לבחור תשובה אחת מתוך רשימה נפתחת.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Adds a dropdown list to the form. const item = form.addListItem(); // Sets the title to 'Do you prefer cats or dogs?' item.setTitle('Do you prefer cats or dogs?'); // Sets the description to 'This is description text...' item.setHelpText('This is description text...'); // Creates and adds choices to the dropdown list. item.setChoices([item.createChoice('dog'), item.createChoice('cat')]);
חזרה
ListItem – הפריט שנוצר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addMultipleChoiceItem()
מוסיף פריט שאלה חדש שמאפשר למשיב לבחור אפשרות אחת מתוך רשימה של לחצני בחירה או שדה אופציונלי של 'אחר'.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Adds a multiple choice item to the form. const item = form.addMultipleChoiceItem(); // Sets the title. item.setTitle('What is your favorite ice cream flavor?'); // Creates some choice items. const vanilla = item.createChoice('vanilla'); const chocolate = item.createChoice('chocolate'); const strawberry = item.createChoice('strawberry'); // Sets the choices. item.setChoices([vanilla, chocolate, strawberry]);
חזרה
MultipleChoiceItem – הפריט שנוצר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addPageBreakItem()
מוסיף פריט פריסה חדש שמסמן את תחילת הדף.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Adds page break items to create a second and third page for the form. const pageTwo = form.addPageBreakItem(); const pageThree = form.addPageBreakItem(); // Sets the titles for the pages. pageTwo.setTitle('Page two'); pageThree.setTitle('Page three'); // Upon completion of the first page, sets the form to navigate to the third // page. pageTwo.setGoToPage(pageThree); // Upon completion of the second page, sets the form to navigate back to the // first page. pageThree.setGoToPage(FormApp.PageNavigationType.RESTART);
חזרה
PageBreakItem – הפריט שנוצר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addParagraphTextItem()
מוסיפים פריט שאלה חדש שמאפשר למשיב להזין בלוק טקסט.
// Opens the form by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Adds the paragraph text item. const item = form.addParagraphTextItem(); // Sets the title to 'What is your address?' item.setTitle('What is your address?');
חזרה
ParagraphTextItem – הפריט שנוצר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addPublishedReader(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
addPublishedReader(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
addPublishedReaders(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
addRatingItem()
מוסיף פריט שאלה חדש שמאפשר למשיב לתת דירוג.
// 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();
חזרה
RatingItem – הפריט שנוצר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addScaleItem()
מוסיפה פריט שאלה חדש שמאפשר למשיב לבחור אפשרות אחת מתוך רצף ממוספר של לחצני בחירה.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Adds the scale item. const item = form.addScaleItem(); // Sets the title of the scale item to 'Choose a number.' item.setTitle('Choose a number'); // Sets the scale to 1-5. item.setBounds(1, 5); // Sets the label for the lower and upper bounds. item.setLabels('Lowest', 'Highest');
חזרה
ScaleItem – הפריט שנוצר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addSectionHeaderItem()
מוסיף פריט פריסה חדש שמציין חזותית את תחילת הקטע.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Adds the section heading item. const item = form.addSectionHeaderItem(); // Sets the title to 'Title of new section.' item.setTitle('Title of new section'); // Sets the description. item.setHelpText('Description of new section');
חזרה
SectionHeaderItem – הפריט שנוצר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addTextItem()
מוסיפה פריט שאלה חדש שמאפשר למשיב להזין שורה אחת של טקסט.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Adds a single-line text item. const item = form.addTextItem(); // Sets the title to 'What is your name?' item.setTitle('What is your name?');
חזרה
TextItem – הפריט שנוצר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addTimeItem()
מוסיפה פריט שאלה חדש שמאפשר למשיב לציין שעה ביום.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Adds a question with a time input. const item = form.addTimeItem(); // Sets the title to 'What time do you usually wake up in the morning?' item.setTitle('What time do you usually wake up in the morning?');
חזרה
TimeItem – הפריט שנוצר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addVideoItem()
מוסיף פריט פריסה חדש שמציג סרטון.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Adds a video item. const item = form.addVideoItem(); // Sets the title, description, and video. item.setTitle('YouTube video') .setHelpText('Send content automatically via Google Sheets and Apps Script') .setVideoUrl('https://youtu.be/xxgQr-jSu9o'); // Sets the alignment to the center. item.setAlignment(FormApp.Alignment.CENTER);
חזרה
VideoItem – הפריט שנוצר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
canEditResponse()
קובעת אם בטופס מוצג קישור לעריכת תשובה אחרי שליחתה.
ללא קשר להגדרה הזו, השיטה FormResponse.getEditResponseUrl() מאפשרת ליוצר הסקריפט שיש לו גישת עריכה לטופס ליצור כתובת 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
collectsEmail()
קובעת אם הטופס יאסוף את כתובות האימייל של המשיבים.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Sets the form to not collect respondents' email addresses. form.setCollectEmail(false); // Checks whether the form collects respondents' email addresses and logs it to // the console. const bool = form.collectsEmail(); console.log(bool);
חזרה
Boolean – true אם הטופס אוסף כתובות אימייל, false אם לא.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
createResponse()
יצירת תשובה חדשה לטופס. כדי להשיב לשאלה, יוצרים ItemResponse מהשאלה ומצרפים אותו לתשובה לטופס באמצעות הקריאה FormResponse.withItemResponse(response). כדי לשמור את התשובה המורכבת, מתקשרים אל FormResponse.submit().
חזרה
FormResponse — התגובה החדשה לטופס.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
deleteAllResponses()
מחיקת כל התשובות שנשלחו ממאגר התשובות של הטופס. השיטה הזו לא מוחקת עותקים של תשובות ששמורים ביעד חיצוני לתשובות (כמו גיליון אלקטרוני), אבל היא מוחקת את תצוגת הסיכום של הטופס.
חזרה
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
deleteItem(index)
מוחק את הפריט באינדקס נתון מבין כל הפריטים בטופס. מוחזרת חריגה של סקריפט אם לא קיים פריט באינדקס הנתון.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Gets all the items from the form. const items = form.getItems(); // Finds the index of a paragraph text item and deletes it by the item's index. const index = items.findIndex( (item) => item.getType() === FormApp.ItemType.PARAGRAPH_TEXT, ); if (index !== -1) { form.deleteItem(index); }
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
index | Integer | האינדקס של הפריט מבין כל הפריטים בטופס. |
מקפיצה את הודעות השגיאה (Throws)
Error – אם לא קיים פריט באינדקס הנתון
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
deleteItem(item)
מחיקת הפריט שצוין. אם הפריט כבר נמחק, הפונקציה מחזירה חריגה של סקריפט.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Gets all of the items from the form. const items = form.getItems(); // Finds a paragraph text item and deletes it. const item = items.find( (item) => item.getType() === FormApp.ItemType.PARAGRAPH_TEXT, ); if (item) { form.deleteItem(item); }
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
item | Item | הפריט שרוצים למחוק. |
מקפיצה את הודעות השגיאה (Throws)
Error – אם הפריט לא קיים בטופס
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
deleteResponse(responseId)
מחיקת תגובה אחת ממאגר התגובות של הטופס. השיטה הזו לא מוחקת עותקים של תשובות ששמורים ביעד חיצוני לתשובות (כמו גיליון אלקטרוני), אבל היא מסירה את התשובה מתצוגת הסיכום של הטופס. אפשר לאחזר את מזהה התשובה באמצעות FormResponse.getId().
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
response | String | המזהה של התשובה לטופס שרוצים למחוק. |
חזרה
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getConfirmationMessage()
מקבל את הודעת האישור של הטופס.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Sets the confirmation message to display after someone submits the form. form.setConfirmationMessage('You successfully submitted the form.'); // Gets the confirmation message and logs it to the console. const message = form.getConfirmationMessage(); console.log(message);
חזרה
String — הודעת האישור של הטופס.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getCustomClosedFormMessage()
מחזירה את ההודעה המותאמת אישית שמוצגת אם הטופס לא מקבל תשובות, או מחזירה מחרוזת ריקה אם לא מוגדרת הודעה מותאמת אישית.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Sets a custom closed form message to display to the user when the form // no longer accepts responses. form.setCustomClosedFormMessage('The form is no longer accepting responses.'); // Gets the custom message set for the form and logs it to the console. const message = form.getCustomClosedFormMessage(); console.log(message);
חזרה
String — ההודעה המותאמת אישית שתוצג אם הטופס לא מקבל תשובות, או מחרוזת ריקה אם לא הוגדרה הודעה מותאמת אישית.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getDescription()
מחזירה את התיאור של הטופס.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Sets the form description. form.setDescription('This is the form description.'); // Gets the form description and logs it to the console. const description = form.getDescription(); console.log(description);
חזרה
String – תיאור הטופס.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getDestinationId()
מחזירה את המזהה של יעד התשובות של הטופס.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Creates a spreadsheet to use as the response destination. const ss = SpreadsheetApp.create('Test_Spreadsheet'); // Updates the form's response destination. form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId()); // Gets the ID of the form's response destination and logs it to the console. const destinationId = form.getDestinationId(); console.log(destinationId);
חזרה
String – המזהה של יעד התשובות בטופס.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getDestinationType()
מחזירה את סוג היעד של התשובות בטופס.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc1234556/edit', ); // Gets the type of the form's response destination and logs it to the console. const destinationType = form.getDestinationType().name(); console.log(destinationType);
חזרה
DestinationType – סוג היעד לתגובה בטופס.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getEditUrl()
מחזירה את כתובת ה-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
getEditors()
getId()
מקבל את המזהה של הטופס.
// Opens the form by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Gets the ID of the form and logs it to the console. const id = form.getId(); console.log(id);
חזרה
String – המזהה של הטופס.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getItemById(id)
מקבל את הפריט עם מזהה נתון. הפונקציה מחזירה null אם המזהה לא תואם לפריט בטופס.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Gets the ID of the first item on the form. const itemId = form.getItems()[0].getId(); // Gets the item from the ID. const item = form.getItemById(itemId); // Gets the name of the item type and logs it to the console. const type = item.getType().name(); console.log(type);
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
id | Integer | המזהה של הפריט. |
חזרה
Item|null – הפריט עם המזהה שצוין, או null אם הפריט לא קיים בטופס.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getItems()
מחזירה מערך של כל הפריטים בטופס.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Gets the list of items in the form. const items = form.getItems(); // Gets the type for each item and logs them to the console. const types = items.map((item) => item.getType().name()); console.log(types);
חזרה
Item[] – מערך של כל הפריטים בטופס.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getItems(itemType)
הפונקציה מחזירה מערך של כל הפריטים מסוג מסוים.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Gets a list of all checkbox items on the form. const items = form.getItems(FormApp.ItemType.CHECKBOX); // Gets the title of each checkbox item and logs them to the console. const checkboxItemsTitle = items.map( (item) => item.asCheckboxItem().getTitle(), ); console.log(checkboxItemsTitle);
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
item | Item | סוג הפריטים לאחזור. |
חזרה
Item[] – מערך של כל הפריטים מהסוג הזה.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getPublishedReaders()
מחזירה את רשימת המשיבים של ה-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
getPublishedUrl()
מחזירה את כתובת ה-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
getResponse(responseId)
מקבל תגובה אחת לטופס על סמך מזהה התשובה. אפשר לאחזר את מזהי התשובות מ-FormResponse.getId().
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
response | String | המזהה של התשובה לטופס. |
חזרה
FormResponse — התשובה לטופס.
מקפיצה את הודעות השגיאה (Throws)
Error — אם התשובה לא קיימת
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getResponses()
מחזירה מערך של כל התשובות בטופס.
חזרה
FormResponse[] – מערך של כל התגובות בטופס.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getResponses(timestamp)
מחזירה מערך של כל התשובות בטופס אחרי תאריך ושעה מסוימים.
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
timestamp | Date | התאריך והשעה המוקדמים ביותר שבהם צריך להחזיר תשובות לטופס. |
חזרה
FormResponse[] — רשימת התשובות לטופס.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getShuffleQuestions()
קובעת אם סדר השאלות בכל דף בטופס הוא אקראי.
חזרה
Boolean – true אם סדר השאלות בכל דף בטופס הוא אקראי;
false אם לא.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getSummaryUrl()
מחזירה את כתובת ה-URL שאפשר להשתמש בה כדי לראות סיכום של התשובות בטופס. אלא אם המדיניות setPublishingSummary(enabled) מוגדרת כ-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
getTitle()
הפונקציה מחזירה את הכותרת של הטופס.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Sets the title of the form to 'For_Testing.' form.setTitle('For_Testing'); // Gets the title of the form and logs it to the console. const title = form.getTitle(); console.log(title);
חזרה
String – כותרת הטופס.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
hasLimitOneResponsePerUser()
קובעת אם כל משיב יכול לשלוח רק תשובה אחת לטופס. אם הערך הוא true, הסקריפט לא יכול לשלוח תגובות לטופס בכלל.
חזרה
Boolean — true אם הטופס מאפשר רק תשובה אחת לכל משיב, false אם לא.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
hasProgressBar()
קובעת אם יוצג סרגל התקדמות בטופס.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // Opens the form by its URL. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Displays the progress bar on the form. form.setProgressBar(true); // Checks if the form displays a progress bar and logs it to the console. console.log(form.hasProgressBar());
חזרה
Boolean — true אם מוצג סרגל התקדמות בטופס; false אם לא מוצג סרגל התקדמות.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
hasRespondAgainLink()
ההגדרה קובעת אם יוצג בטופס קישור לשליחת תשובה נוספת אחרי שמשיב משלים את הטופס.
// 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
isAcceptingResponses()
קובעת אם הטופס מקבל כרגע תשובות. הערך הזה נדרס כשמצב הפרסום של הטופס משתנה.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Sets the form to accept responses. form.setAcceptingResponses(true); // Checks if the form is accepting responses or not and logs it to the console. const accepting = form.isAcceptingResponses(); console.log(accepting);
חזרה
Boolean — true אם אפשר לשלוח תשובות לטופס; false אם אי אפשר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
isPublished()
קובעת אם הטופס פורסם.
התכונה הזו זמינה רק בטפסים שתומכים בפרסום. משתמשים בלחצן supportsAdvancedResponderPermissions() כדי לבדוק אם הטופס תומך בפרסום.
// 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
isPublishingSummary()
קובעת אם בטופס יוצג קישור לצפייה בסיכום התשובות אחרי שהמשיב יסיים למלא את הטופס.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Sets the form to display a link to a summary of // the responses after someone submits the form. form.setPublishingSummary(true); // Checks if the form displays a "See previous responses" link and logs it to // the console. const publishingLink = form.isPublishingSummary(); console.log(publishingLink);
חזרה
Boolean — true אם בטופס מוצג הקישור 'לצפייה בתשובות הקודמות'; false אם לא.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
isQuiz()
קובעת אם הטופס הוא בוחן.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Sets the form as a quiz. form.setIsQuiz(true); // Checks if the form is a quiz or not and logs it to the console. console.log(form.isQuiz());
חזרה
Boolean — true אם אפשר לשלוח תשובות לטופס; false אם אי אפשר.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
moveItem(from, to)
הפעולה מעבירה פריט באינדקס נתון בין כל הפריטים בטופס לאינדקס נתון אחר. הפונקציה זורקת חריגה של סקריפט אם האינדקס to חורג מהטווח.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Moves the first item to be the last item. form.moveItem(0, form.getItems().length - 1);
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
from | Integer | האינדקס הנוכחי של הפריט מתוך כל הפריטים בטופס. |
to | Integer | האינדקס החדש של הפריט מבין כל הפריטים בטופס. |
חזרה
Item — הפריט שהועבר.
מקפיצה את הודעות השגיאה (Throws)
Error – אם אחד מהאינדקסים חורג מהגבולות.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
moveItem(item, toIndex)
מעביר פריט נתון לאינדקס נתון מבין כל הפריטים בטופס. הפונקציה מעלה חריגה (exception) של סקריפטים אם האינדקס שצוין חורג מהטווח.
// 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
removeDestination()
ביטול הקישור של הטופס ליעד התשובות הנוכחי שלו. היעד הקודם שלא מקושר עדיין מכיל עותק של כל התגובות הקודמות. כל הטפסים, כולל אלה שלא הוגדר להם יעד באופן מפורש, שומרים עותק של התשובות במאגר התשובות של הטופס. אם לטופס אין כרגע יעד לתגובות, לשיטה הזו אין השפעה.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Opens a spreadsheet to use for the response destination. // TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp.openByUrl( 'https://docs.google.com/spreadsheets/d/abc123456/edit', ); // Updates the form's response destination to the spreadsheet. form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId()); // Unlinks the form from the spreadsheet. form.removeDestination();
חזרה
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
removeEditor(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
removeEditor(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
removePublishedReader(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
removePublishedReader(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
setAcceptingResponses(enabled)
הגדרה של האפשרות לקבל תשובות לטופס. ברירת המחדל לטפסים חדשים היא true. המצב נמחק כשמשנים את מצב הפרסום של הטופס.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Sets the form to accept responses. form.setAcceptingResponses(true); // Checks whether the form is accepting responses or not and logs it to the // console. console.log(form.isAcceptingResponses());
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
enabled | Boolean | true אם הטופס צריך לקבל תשובות; false אם הוא לא צריך לקבל תשובות. |
חזרה
מקפיצה את הודעות השגיאה (Throws)
Error – אם האפשרות הזו מופעלת בטופס שהפרסום שלו בוטל.
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setAllowResponseEdits(enabled)
הגדרה של הצגת קישור לעריכת תשובה בטופס אחרי שליחתה. ברירת המחדל לטפסים חדשים היא false.
ללא קשר להגדרה הזו, השיטה FormResponse.getEditResponseUrl() מאפשרת ליוצר הסקריפט שיש לו הרשאת עריכה בטופס ליצור כתובת 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
setCollectEmail(collect)
הגדרה של איסוף כתובות האימייל של המשיבים בטופס. ברירת המחדל לטפסים חדשים היא false.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Sets the form to collect respondents' email addresses. form.setCollectEmail(true); // Checks whether the value is set to true or false and logs it to the console. const collect = form.collectsEmail(); console.log(collect);
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
collect | Boolean | true אם הטופס צריך לאסוף כתובות אימייל, false אם לא. |
חזרה
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setConfirmationMessage(message)
הגדרת הודעת האישור של הטופס.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Sets a custom confirmation message to display after someone submits the form. form.setConfirmationMessage('Your form has been successfully submitted.'); // Gets the confirmation message set for the form and logs it to the console. const message = form.getConfirmationMessage(); console.log(message);
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
message | String | הודעת האישור החדשה של הטופס. |
חזרה
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setCustomClosedFormMessage(message)
הגדרת ההודעה שתוצג אם הטופס לא מקבל תשובות. אם לא מגדירים הודעה, הטופס משתמש בהודעת ברירת מחדל.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Sets the form to not accept responses. form.setAcceptingResponses(false); // Sets a custom closed form message to display to the user. form.setCustomClosedFormMessage('The form is no longer accepting responses.'); // Gets the custom message set for the form and logs it to the console. const message = form.getCustomClosedFormMessage(); console.log(message);
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
message | String | ההודעה שתוצג אם אי אפשר לשלוח תשובות לטופס. |
חזרה
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setDescription(description)
setDestination(type, id)
ההגדרה הזו קובעת את היעד שבו נשמרות התשובות לטופס. כל הטפסים, כולל אלה שלא הוגדר להם יעד באופן מפורש, שומרים עותק של התשובות במאגר התשובות של הטופס.
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
type | Destination | סוג היעד של התשובות לטופס. |
id | String | המזהה של יעד התשובות של הטופס. |
חזרה
מקפיצה את הודעות השגיאה (Throws)
Error — אם מזהה היעד שצוין לא תקין
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setIsQuiz(enabled)
קובע אם הטופס הוא בוחן. ברירת המחדל לטפסים חדשים היא false.
אפשר להשתמש בשאלות עם ציון רק בחידונים, ולכן אם מגדירים את האפשרות הזו לערך false, כל אפשרויות הציון יוסרו מכל השאלות.
הגדרות הבוחן זמינות רק בממשק המשתמש החדש של Forms. כשמגדירים טופס כבוחן, הטופס עובר לשימוש בממשק המשתמש החדש.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Makes the form a quiz. form.setIsQuiz(true); // Checks whether the form is a quiz or not and logs it to the console. console.log(form.isQuiz());
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
enabled | Boolean | true אם צריך להפעיל את תכונות הבוחן בטופס; false אם לא. |
חזרה
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setLimitOneResponsePerUser(enabled)
הגדרה של האפשרות שכל משיב יוכל לשלוח רק תשובה אחת לטופס. ברירת המחדל לטפסים חדשים היא false. אם הערך מוגדר כ-true, הסקריפט לא יכול לשלוח תגובות לטופס בכלל.
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
enabled | Boolean | true אם הטופס צריך לאפשר רק תשובה אחת לכל משיב; false אם לא. |
חזרה
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setProgressBar(enabled)
קובע אם בטופס יוצג סרגל התקדמות. ברירת המחדל לטפסים חדשים היא false.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl( 'https://docs.google.com/forms/d/abc123456/edit', ); // Displays the progress bar on the form. form.setProgressBar(true); // Checks whether the form has a progress bar and logs it to the console. console.log(form.hasProgressBar());
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
enabled | Boolean | true אם מוצג בסקר סרגל התקדמות, false אם לא מוצג. |
חזרה
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setPublished(enabled)
הגדרה של פרסום הטופס. ברירת המחדל לטפסים חדשים היא true.
התכונה הזו זמינה רק בטפסים שתומכים בפרסום. משתמשים בלחצן supportsAdvancedResponderPermissions() כדי לבדוק אם הטופס תומך בפרסום.
כדי שהמשיבים יוכלו לגשת לטופס, צריך לפרסם אותו. השיטה הזו מחליפה את הקריאות ל-setAcceptingResponses(enabled).
// 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
setPublishingSummary(enabled)
קובע אם בטופס יוצג קישור לצפייה בסיכום התשובות אחרי שהמשיב ישלח את הטופס. ברירת המחדל לטפסים חדשים היא false.
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
enabled | Boolean | true אם רוצים שהקישור 'צפייה בתשובות הקודמות' יוצג בטופס, false אם לא רוצים. |
חזרה
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setShowLinkToRespondAgain(enabled)
ההגדרה הזו קובעת אם יוצג בטופס קישור לשליחת תגובה נוספת אחרי שהמשיב מסיים למלא את הטופס. ברירת המחדל לטפסים חדשים היא true.
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
enabled | Boolean | true אם בטופס צריך להופיע הקישור 'שליחת תגובה נוספת' false או לא. |
חזרה
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setShuffleQuestions(shuffle)
הגדרה של סדר אקראי לשאלות בכל דף בטופס.
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
shuffle | Boolean | true אם הסדר של השאלות בכל דף בטופס צריך להיות אקראי, false אם לא. |
חזרה
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setTitle(title)
shortenFormUrl(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
submitGrades(responses)
שליחת ציונים לתשובות שניתנו בטופס.
אם הקוד כולל טריגר onFormSubmit, קריאה ל-submitGrades()
מפעילה את התנאי onFormSubmit וגורמת ללולאה אינסופית. כדי למנוע את הלולאה האינסופית, מוסיפים קוד שבודק אם הציונים כבר קיימים לפני שמפעילים את submitGrades().
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
responses | Form | מערך של כל התשובות בטופס. |
חזרה
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחת או יותר מההיקפים הבאים:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
supportsAdvancedResponderPermissions()
קובעת אם הטופס תומך בפרסום. השיטה הזו משמשת כדי לקבוע אם השיטות setPublished(enabled) ו-isPublished() וההרשאות של המשיב זמינות.
// 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