Ein Formular, das allgemeine Eigenschaften und Elemente enthält. Zu den Attributen gehören Titel, Einstellungen und der Speicherort der Antworten. Zu den Elementen gehören Frageelemente wie
Kästchen oder Optionsfelder, während sich Layoutelemente Sie können über FormApp
auf Formulare zugreifen oder sie erstellen.
// Open a form by ID and create a new spreadsheet. var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); var ss = SpreadsheetApp.create('Spreadsheet Name'); // Update form properties via chaining. form.setTitle('Form Name') .setDescription('Description of form') .setConfirmationMessage('Thanks for responding!') .setAllowResponseEdits(true) .setAcceptingResponses(false); // Update the form's response destination. form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());
Methoden
Methode | Rückgabetyp | Kurzbeschreibung |
---|---|---|
addCheckboxGridItem() | CheckboxGridItem | Hängt ein neues Frageelement an, das als Raster aus Spalten und Zeilen dargestellt wird, mit dem der Teilnehmer mehrere Auswahlmöglichkeiten pro Zeile aus einer Reihe von Kästchen auswählen kann. |
addCheckboxItem() | CheckboxItem | Fügt ein neues Frageelement hinzu, mit dem der Befragte ein oder mehrere Kästchen sowie ein optionales Feld "Sonstiges" auswählen kann. |
addDateItem() | DateItem | Fügt eine neue Frage an, mit der der Teilnehmer ein Datum angeben kann. |
addDateTimeItem() | DateTimeItem | Fügt eine neue Frage an, mit der der Teilnehmer ein Datum und eine Uhrzeit angeben kann. |
addDurationItem() | DurationItem | Fügt eine neue Frage an, mit der der Teilnehmer die Zeitspanne angeben kann. |
addEditor(emailAddress) | Form | Fügt den angegebenen Nutzer der Liste der Bearbeiter für Form hinzu. |
addEditor(user) | Form | Fügt den angegebenen Nutzer der Liste der Bearbeiter für Form hinzu. |
addEditors(emailAddresses) | Form | Fügt das angegebene Array von Nutzern der Liste der Bearbeiter für Form hinzu. |
addGridItem() | GridItem | Hängt ein neues Frageelement an, das als Raster aus Spalten und Zeilen dargestellt wird, mit dem der Befragte eine Auswahl pro Zeile aus einer Reihe von Optionsfeldern auswählen kann. |
addImageItem() | ImageItem | Hängt ein neues Layoutelement an, das ein Bild anzeigt. |
addListItem() | ListItem | Hängt ein neues Frageelement an, mit dem der Befragte eine Antwort aus einer Drop-down-Liste auswählen kann. |
addMultipleChoiceItem() | MultipleChoiceItem | Fügt ein neues Frageelement hinzu, mit dem der Befragte eine Auswahl aus einer Liste von Optionsfeldern oder einem optionalen Feld "Sonstiges" auswählen kann. |
addPageBreakItem() | PageBreakItem | Fügt ein neues Layoutelement hinzu, das den Anfang einer Seite markiert. |
addParagraphTextItem() | ParagraphTextItem | Fügt eine neue Frage hinzu, in die der Teilnehmer einen Textblock eingeben kann. |
addScaleItem() | ScaleItem | Hängt ein neues Frageelement an, mit dem der Befragte eine Option aus einer nummerierten Folge von Optionsfeldern auswählen kann. |
addSectionHeaderItem() | SectionHeaderItem | Hängt ein neues Layoutelement an, das den Beginn eines Abschnitts visuell darstellt. |
addTextItem() | TextItem | Hängt eine neue Frage an, über die der Teilnehmer eine einzelne Textzeile eingeben kann. |
addTimeItem() | TimeItem | Fügt eine neue Frage an, mit der der Teilnehmer eine Tageszeit angeben kann. |
addVideoItem() | VideoItem | Hängt ein neues Layoutelement an, das ein Video anzeigt. |
canEditResponse() | Boolean | Legt fest, ob im Formular ein Link zum Bearbeiten einer Antwort nach dem Senden angezeigt wird. |
collectsEmail() | Boolean | Legt fest, ob beim Ausfüllen des Formulars die E-Mail-Adressen der Befragten erfasst werden. |
createResponse() | FormResponse | Erstellt eine neue Antwort für das Formular. |
deleteAllResponses() | Form | Löscht alle gesendeten Antworten aus dem Antwortspeicher des Formulars. |
deleteItem(index) | void | Löscht das Element bei einem bestimmten Index aus allen Elementen im Formular. |
deleteItem(item) | void | Löscht das angegebene Element. |
deleteResponse(responseId) | Form | Löscht eine einzelne Antwort aus dem Antwortspeicher des Formulars. |
getConfirmationMessage() | String | Ruft die Bestätigungsnachricht des Formulars ab. |
getCustomClosedFormMessage() | String | Ruft die benutzerdefinierte Nachricht ab, die angezeigt wird, wenn das Formular keine Antworten annimmt, oder einen leeren String, wenn keine benutzerdefinierte Nachricht festgelegt wurde. |
getDescription() | String | Ruft die Beschreibung des Formulars ab. |
getDestinationId() | String | Ruft die ID des Antwortziels des Formulars ab. |
getDestinationType() | DestinationType | Ruft den Typ des Antwortziels des Formulars ab. |
getEditUrl() | String | Ruft die URL ab, über die der Bearbeitungsmodus des Formulars aufgerufen werden kann. |
getEditors() | User[] | Ruft die Liste der Bearbeiter für diesen Form ab. |
getId() | String | Ruft die ID des Formulars ab. |
getItemById(id) | Item | Ruft das Element mit einer bestimmten ID ab. |
getItems() | Item[] | Ruft ein Array aller Elemente im Formular ab. |
getItems(itemType) | Item[] | Ruft ein Array aller Elemente eines bestimmten Typs ab. |
getPublishedUrl() | String | Ruft die URL ab, die zum Ausfüllen des Formulars verwendet werden kann. |
getResponse(responseId) | FormResponse | Ruft eine einzelne Formularantwort basierend auf ihrer Antwort-ID ab. |
getResponses() | FormResponse[] | Ruft ein Array aller Formularantworten ab. |
getResponses(timestamp) | FormResponse[] | Ruft ein Array aller Formularantworten nach einem bestimmten Datum und einer bestimmten Uhrzeit ab. |
getShuffleQuestions() | Boolean | Hiermit wird festgelegt, ob die Reihenfolge der Fragen auf den einzelnen Seiten des Formulars zufällig ausgewählt wird. |
getSummaryUrl() | String | Ruft die URL ab, über die eine Zusammenfassung der Formularantworten angezeigt werden kann. |
getTitle() | String | Ruft den Titel des Formulars ab. |
hasLimitOneResponsePerUser() | Boolean | Bestimmt, ob das Formular nur eine Antwort pro Teilnehmer zulässt. |
hasProgressBar() | Boolean | Legt fest, ob auf dem Formular ein Fortschrittsbalken angezeigt wird. |
hasRespondAgainLink() | Boolean | Legt fest, ob im Formular ein Link zum Senden einer weiteren Antwort angezeigt wird, nachdem ein Teilnehmer das Formular ausgefüllt hat. |
isAcceptingResponses() | Boolean | Legt fest, ob für das Formular derzeit Antworten angenommen werden. |
isPublishingSummary() | Boolean | Legt fest, ob im Formular ein Link angezeigt wird, über den eine Zusammenfassung der Antworten aufgerufen werden kann, nachdem ein Teilnehmer das Formular ausgefüllt hat. |
isQuiz() | Boolean | Hiermit wird festgelegt, ob das Formular ein Quiz ist. |
moveItem(from, to) | Item | Verschiebt ein Element bei einem bestimmten Index zwischen allen Elementen in dem Formular in einen anderen bestimmten Index. |
moveItem(item, toIndex) | Item | Verschiebt ein bestimmtes Element in einen bestimmten Index unter allen Elementen im Formular. |
removeDestination() | Form | Hebt die Verknüpfung des Formulars mit seinem aktuellen Antwortziel auf. |
removeEditor(emailAddress) | Form | Entfernt den angegebenen Nutzer aus der Liste der Bearbeiter für Form . |
removeEditor(user) | Form | Entfernt den angegebenen Nutzer aus der Liste der Bearbeiter für Form . |
requiresLogin() | Boolean | Legt fest, ob sich Befragte in einem Konto in derselben Domain oder in einer Subdomain anmelden müssen, bevor sie antworten. |
setAcceptingResponses(enabled) | Form | Legt fest, ob das Formular derzeit Antworten akzeptiert. |
setAllowResponseEdits(enabled) | Form | Legt fest, ob im Formular ein Link zum Bearbeiten einer Antwort nach dem Senden angezeigt wird. |
setCollectEmail(collect) | Form | Legt fest, ob im Formular die E-Mail-Adressen der Befragten erfasst werden. |
setConfirmationMessage(message) | Form | Legt die Bestätigungsnachricht des Formulars fest. |
setCustomClosedFormMessage(message) | Form | Legt fest, dass die Nachricht angezeigt wird, wenn das Formular keine Antworten akzeptiert. |
setDescription(description) | Form | Legt die Beschreibung des Formulars fest. |
setDestination(type, id) | Form | Legt das Ziel fest, an dem die Formularantworten gespeichert werden. |
setIsQuiz(enabled) | Form | Legt fest, ob das Formular ein Quiz ist. |
setLimitOneResponsePerUser(enabled) | Form | Legt fest, ob im Formular nur eine Antwort pro Teilnehmer zulässig ist. |
setProgressBar(enabled) | Form | Legt fest, ob das Formular eine Fortschrittsanzeige hat. |
setPublishingSummary(enabled) | Form | Legt fest, ob im Formular ein Link angezeigt wird, über den eine Zusammenfassung der Antworten aufgerufen werden kann, nachdem ein Teilnehmer das Formular gesendet hat. |
setRequireLogin(requireLogin) | Form | Legt fest, ob sich Umfrageteilnehmer in einem Konto in derselben Domain oder einer Subdomain anmelden müssen, bevor sie antworten. |
setShowLinkToRespondAgain(enabled) | Form | Legt fest, ob im Formular ein Link zum Senden einer weiteren Antwort angezeigt wird, nachdem ein Befragter das Formular ausgefüllt hat. |
setShuffleQuestions(shuffle) | Form | Legt fest, ob die Fragen auf den einzelnen Seiten des Formulars zufällig angeordnet werden. |
setTitle(title) | Form | Legt den Titel des Formulars fest. |
shortenFormUrl(url) | String | Wandelt eine lange URL für ein Formular in eine kurze URL um. |
submitGrades(responses) | Form | Übermittelt Noten für die angegebenen FormResponses. |
Detaillierte Dokumentation
addCheckboxGridItem()
Hängt ein neues Frageelement an, das als Raster aus Spalten und Zeilen dargestellt wird, mit dem der Teilnehmer mehrere Auswahlmöglichkeiten pro Zeile aus einer Reihe von Kästchen auswählen kann.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Adds a checkbox grid item. const item = form.addCheckboxGridItem(); // Sets the title 'Where did you celebrate New Year's?' item.setTitle('Where did you celebrate New Year's?'); // Sets the grid's rows and columns. item.setRows(['New York', 'San Francisco', 'London']) .setColumns(['2014', '2015', '2016', '2017']);
Return
CheckboxGridItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addCheckboxItem()
Fügt ein neues Frageelement hinzu, mit dem der Befragte ein oder mehrere Kästchen sowie ein optionales Feld "Sonstiges" auswählen kann.
// 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']);
Return
CheckboxItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addDateItem()
Fügt eine neue Frage an, mit der der Teilnehmer ein Datum angeben kann.
// 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.');
Return
DateItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addDateTimeItem()
Fügt eine neue Frage an, mit der der Teilnehmer ein Datum und eine Uhrzeit angeben kann.
// 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);
Return
DateTimeItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addDurationItem()
Fügt eine neue Frage an, mit der der Teilnehmer die Zeitspanne angeben kann.
// 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);
Return
DurationItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addEditor(emailAddress)
Fügt den angegebenen Nutzer der Liste der Bearbeiter für Form
hinzu. Wenn der Nutzer bereits in der Liste der Betrachter enthalten war, wird er mit dieser Methode aus der Liste der Betrachter herausgestuft.
Parameter
Name | Typ | Beschreibung |
---|---|---|
emailAddress | String | Die E-Mail-Adresse des Nutzers, der hinzugefügt werden soll. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addEditor(user)
Fügt den angegebenen Nutzer der Liste der Bearbeiter für Form
hinzu. Wenn der Nutzer bereits in der Liste der Betrachter enthalten war, wird er mit dieser Methode aus der Liste der Betrachter herausgestuft.
Parameter
Name | Typ | Beschreibung |
---|---|---|
user | User | Eine Darstellung des hinzuzufügenden Nutzers. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addEditors(emailAddresses)
Fügt das angegebene Array von Nutzern der Liste der Bearbeiter für Form
hinzu. Wenn einer der Nutzer bereits in der Liste der Betrachter enthalten war, wird er mit dieser Methode aus der Liste der Betrachter herausgestuft.
Parameter
Name | Typ | Beschreibung |
---|---|---|
emailAddresses | String[] | Ein Array mit E-Mail-Adressen der hinzuzufügenden Nutzer. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addGridItem()
Hängt ein neues Frageelement an, das als Raster aus Spalten und Zeilen dargestellt wird, mit dem der Befragte eine Auswahl pro Zeile aus einer Reihe von Optionsfeldern auswählen kann.
// 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']);
Return
GridItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addImageItem()
Hängt ein neues Layoutelement an, das ein Bild anzeigt.
// 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);
Return
ImageItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addListItem()
Hängt ein neues Frageelement an, mit dem der Befragte eine Antwort aus einer Drop-down-Liste auswählen kann.
// 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') ]);
Return
ListItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addMultipleChoiceItem()
Fügt ein neues Frageelement hinzu, mit dem der Befragte eine Auswahl aus einer Liste von Optionsfeldern oder einem optionalen Feld "Sonstiges" auswählen kann.
// 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]);
Return
MultipleChoiceItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addPageBreakItem()
Fügt ein neues Layoutelement hinzu, das den Anfang einer Seite markiert.
// 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);
Return
PageBreakItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addParagraphTextItem()
Fügt eine neue Frage hinzu, in die der Teilnehmer einen Textblock eingeben kann.
// 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?');
Return
ParagraphTextItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addScaleItem()
Hängt ein neues Frageelement an, mit dem der Befragte eine Option aus einer nummerierten Folge von Optionsfeldern auswählen kann.
// 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');
Return
ScaleItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addSectionHeaderItem()
Hängt ein neues Layoutelement an, das den Beginn eines Abschnitts visuell darstellt.
// 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');
Return
SectionHeaderItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addTextItem()
Hängt eine neue Frage an, über die der Teilnehmer eine einzelne Textzeile eingeben kann.
// 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?');
Return
TextItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addTimeItem()
Fügt eine neue Frage an, mit der der Teilnehmer eine Tageszeit angeben kann.
// 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?');
Return
TimeItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addVideoItem()
Hängt ein neues Layoutelement an, das ein Video anzeigt.
// 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);
Return
VideoItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
canEditResponse()
Legt fest, ob im Formular ein Link zum Bearbeiten einer Antwort nach dem Senden angezeigt wird.
Unabhängig von dieser Einstellung ermöglicht die Methode FormResponse.getEditResponseUrl()
einem Skriptautor, der Bearbeitungszugriff auf das Formular hat, eine URL, mit der eine Antwort bearbeitet werden kann.
// 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);
Return
Boolean
: true
, wenn im Formular ein Link „Antwort bearbeiten“ angezeigt wird; false
, wenn nicht.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
collectsEmail()
Legt fest, ob beim Ausfüllen des Formulars die E-Mail-Adressen der Befragten erfasst werden.
// 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);
Return
Boolean
: true
, wenn mit dem Formular E-Mail-Adressen erfasst werden; false
, wenn nicht.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
createResponse()
Erstellt eine neue Antwort für das Formular. Wenn Sie ein Frageelement beantworten möchten, erstellen Sie ein ItemResponse
aus dem Element und hängen Sie es dann durch Aufrufen von FormResponse.withItemResponse(response)
an diese Formularantwort an. Rufen Sie FormResponse.submit()
auf, um die zusammengestellte Antwort zu speichern.
Return
FormResponse
: die neu erstellte Formularantwort.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
deleteAllResponses()
Löscht alle gesendeten Antworten aus dem Antwortspeicher des Formulars. Diese Methode löscht keine Kopien von Antworten, die in einem externen Antwortziel (z. B. einer Tabelle) gespeichert sind, löscht aber die Zusammenfassungsansicht des Formulars.
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
deleteItem(index)
Löscht das Element bei einem bestimmten Index aus allen Elementen im Formular. Löst eine Skriptausnahme aus, wenn im angegebenen Index kein Element vorhanden ist.
// 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); }
Parameter
Name | Typ | Beschreibung |
---|---|---|
index | Integer | Index des Elements unter allen Elementen im Formular. |
Löst aus
Error
: Wenn beim angegebenen Index kein Element vorhanden ist
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
deleteItem(item)
Löscht das angegebene Element. Löst eine Skriptausnahme aus, wenn das Element bereits gelöscht wurde.
// 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); }
Parameter
Name | Typ | Beschreibung |
---|---|---|
item | Item | Das zu löschende Element. |
Löst aus
Error
: Wenn das Element im Formular nicht vorhanden ist
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
deleteResponse(responseId)
Löscht eine einzelne Antwort aus dem Antwortspeicher des Formulars. Diese Methode löscht keine Kopien von Antworten, die in einem externen Antwortziel (z. B. einer Tabelle) gespeichert sind, entfernt die Antwort jedoch aus der Zusammenfassungsansicht des Formulars. Die Antwort-ID kann mit FormResponse.getId()
abgerufen werden.
Parameter
Name | Typ | Beschreibung |
---|---|---|
responseId | String | Die ID der zu löschenden Formularantwort. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getConfirmationMessage()
Ruft die Bestätigungsnachricht des Formulars ab.
// 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);
Return
String
: Die Bestätigungsnachricht des Formulars.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getCustomClosedFormMessage()
Ruft die benutzerdefinierte Nachricht ab, die angezeigt wird, wenn das Formular keine Antworten annimmt, oder einen leeren String, wenn keine benutzerdefinierte Nachricht festgelegt wurde.
// 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);
Return
String
: Die benutzerdefinierte Nachricht, die angezeigt wird, wenn das Formular keine Antworten akzeptiert, oder ein leerer String, wenn keine benutzerdefinierte Nachricht festgelegt wurde.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getDescription()
Ruft die Beschreibung des Formulars ab.
// 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);
Return
String
: Die Beschreibung des Formulars.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getDestinationId()
Ruft die ID des Antwortziels des Formulars ab.
// 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);
Return
String
: Die ID des Antwortziels des Formulars.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getDestinationType()
Ruft den Typ des Antwortziels des Formulars ab.
// 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);
Return
DestinationType
: Der Typ des Antwortziels des Formulars.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getEditUrl()
Ruft die URL ab, über die der Bearbeitungsmodus des Formulars aufgerufen werden kann.
// 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);
Return
String
: Die URL zum Bearbeiten des Formulars.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getEditors()
Ruft die Liste der Bearbeiter für diesen Form
ab.
Return
User[]
: Ein Array von Nutzern mit Bearbeitungsberechtigung.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getId()
Ruft die ID des Formulars ab.
// 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);
Return
String
: Die ID des Formulars.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getItemById(id)
Ruft das Element mit einer bestimmten ID ab. Gibt null
zurück, wenn die ID keinem Element im Formular entspricht.
// 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);
Parameter
Name | Typ | Beschreibung |
---|---|---|
id | Integer | Die ID des Artikels. |
Return
Item
: Das Element mit der angegebenen ID oder null
, wenn das Element im Formular nicht vorhanden ist.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getItems()
Ruft ein Array aller Elemente im Formular ab.
// 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);
Return
Item[]
: Ein Array aller Elemente im Formular.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getItems(itemType)
Ruft ein Array aller Elemente eines bestimmten Typs ab.
// 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);
Parameter
Name | Typ | Beschreibung |
---|---|---|
itemType | ItemType | Der Typ der abzurufenden Elemente. |
Return
Item[]
: Ein Array aller Elemente dieses Typs.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getPublishedUrl()
Ruft die URL ab, die zum Ausfüllen des Formulars verwendet werden kann.
// 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);
Return
String
: Die URL zum Ausfüllen des Formulars.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getResponse(responseId)
Ruft eine einzelne Formularantwort basierend auf ihrer Antwort-ID ab. Antwort-IDs können aus FormResponse.getId()
abgerufen werden.
Parameter
Name | Typ | Beschreibung |
---|---|---|
responseId | String | Die ID für die Formularantwort. |
Return
FormResponse
: Die Formularantwort.
Löst aus
Error
: Wenn die Antwort nicht vorhanden ist.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getResponses()
Ruft ein Array aller Formularantworten ab.
Return
FormResponse[]
: Ein Array aller Antworten des Formulars.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getResponses(timestamp)
Ruft ein Array aller Formularantworten nach einem bestimmten Datum und einer bestimmten Uhrzeit ab.
Parameter
Name | Typ | Beschreibung |
---|---|---|
timestamp | Date | Datum und Uhrzeit, zu der bzw. zu der Formularantworten frühestens zurückgegeben werden sollen. |
Return
FormResponse[]
: Die Liste der Formularantworten.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getShuffleQuestions()
Hiermit wird festgelegt, ob die Reihenfolge der Fragen auf den einzelnen Seiten des Formulars zufällig ausgewählt wird.
Return
Boolean
: true
, wenn die Reihenfolge der Fragen auf jeder Seite des Formulars randomisiert ist; andernfalls false
.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getSummaryUrl()
Ruft die URL ab, über die eine Zusammenfassung der Formularantworten angezeigt werden kann. Nur Nutzer mit Bearbeitungsberechtigung für das Formular können auf die URL zugreifen, es sei denn, setPublishingSummary(enabled)
ist auf true
gesetzt.
// 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);
Return
String
: Die URL zum Anzeigen einer Zusammenfassung der Antworten.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getTitle()
Ruft den Titel des Formulars ab.
// 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);
Return
String
: Der Titel des Formulars.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
hasLimitOneResponsePerUser()
Bestimmt, ob das Formular nur eine Antwort pro Teilnehmer zulässt. Wenn der Wert true
ist, kann das Skript keine Formularantworten senden.
Return
Boolean
: true
, wenn das Formular nur eine Antwort pro Teilnehmer zulässt; false
, wenn nicht.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
hasProgressBar()
Legt fest, ob auf dem Formular ein Fortschrittsbalken angezeigt wird.
// 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());
Return
Boolean
: true
, wenn das Formular einen Fortschrittsbalken anzeigt; false
, wenn nicht.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
hasRespondAgainLink()
Legt fest, ob im Formular ein Link zum Senden einer weiteren Antwort angezeigt wird, nachdem ein Teilnehmer das Formular ausgefüllt hat.
// 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());
Return
Boolean
: true
, wenn im Formular der Link „Weitere Antwort senden“ angezeigt wird; false
, wenn nicht.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
isAcceptingResponses()
Legt fest, ob für das Formular derzeit Antworten angenommen werden.
// 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);
Return
Boolean
: true
, wenn das Formular Antworten akzeptiert; false
, wenn nicht.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
isPublishingSummary()
Legt fest, ob im Formular ein Link angezeigt wird, über den eine Zusammenfassung der Antworten aufgerufen werden kann, nachdem ein Teilnehmer das Formular ausgefüllt hat.
// 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);
Return
Boolean
: true
, wenn im Formular der Link „Vorherige Antworten anzeigen“ angezeigt wird; false
, wenn nicht.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
isQuiz()
Hiermit wird festgelegt, ob das Formular ein Quiz ist.
// 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());
Return
Boolean
: true
, wenn das Formular Antworten akzeptiert; false
, wenn nicht.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
moveItem(from, to)
Verschiebt ein Element bei einem bestimmten Index zwischen allen Elementen in dem Formular in einen anderen bestimmten Index. Löst eine Skriptausnahme aus, wenn der Index to
außerhalb des gültigen Bereichs liegt.
// 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);
Parameter
Name | Typ | Beschreibung |
---|---|---|
from | Integer | Der aktuelle Index des Elements unter allen Elementen im Formular. |
to | Integer | Der neue Index für das Element unter allen Elementen im Formular. |
Return
Item
: Das Element, das verschoben wurde.
Löst aus
Error
– wenn einer der Index außerhalb des gültigen Bereichs liegt.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
moveItem(item, toIndex)
Verschiebt ein bestimmtes Element in einen bestimmten Index unter allen Elementen im Formular. Löst eine Skriptausnahme aus, wenn der angegebene Index außerhalb des Bereichs liegt.
// 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);
Parameter
Name | Typ | Beschreibung |
---|---|---|
item | Item | Das zu verschiebende Element. |
toIndex | Integer | Der neue Index für das Element unter allen Elementen im Formular. |
Return
Item
: Das Element, das verschoben wurde.
Löst aus
Error
: Wenn der Index außerhalb des gültigen Bereichs liegt.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
removeDestination()
Hebt die Verknüpfung des Formulars mit seinem aktuellen Antwortziel auf. Das nicht verknüpfte frühere Ziel enthält weiterhin eine Kopie aller vorherigen Antworten. In allen Formularen wird eine Kopie der Antworten im Antwortspeicher des Formulars gespeichert. Dies gilt auch für Formulare, für die nicht explizit ein Ziel festgelegt ist. Wenn das Formular derzeit kein Antwortziel hat, hat diese Methode keine Auswirkungen.
// 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();
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
removeEditor(emailAddress)
Entfernt den angegebenen Nutzer aus der Liste der Bearbeiter für Form
. Diese Methode verhindert nicht, dass Nutzer auf Form
zugreifen, wenn sie zu einer Klasse von Nutzern mit allgemeinen Zugriff gehören. Das ist z. B. der Fall, wenn Form
für die gesamte Domain des Nutzers freigegeben ist oder wenn sich Form
in einer geteilten Ablage befindet, auf die der Nutzer zugreifen kann.
Bei Drive-Dateien wird der Nutzer auch aus der Liste der Viewer entfernt.
Parameter
Name | Typ | Beschreibung |
---|---|---|
emailAddress | String | Die E-Mail-Adresse des Nutzers, der entfernt werden soll. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
removeEditor(user)
Entfernt den angegebenen Nutzer aus der Liste der Bearbeiter für Form
. Diese Methode verhindert nicht, dass Nutzer auf Form
zugreifen, wenn sie zu einer Klasse von Nutzern mit allgemeinen Zugriff gehören. Das ist z. B. der Fall, wenn Form
für die gesamte Domain des Nutzers freigegeben ist oder wenn sich Form
in einer geteilten Ablage befindet, auf die der Nutzer zugreifen kann.
Bei Drive-Dateien wird der Nutzer auch aus der Liste der Viewer entfernt.
Parameter
Name | Typ | Beschreibung |
---|---|---|
user | User | Eine Darstellung des Nutzers, der entfernt werden soll. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
requiresLogin()
Legt fest, ob sich Befragte in einem Konto in derselben Domain oder in einer Subdomain anmelden müssen, bevor sie antworten.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Checks if the form requires respondents to log in to a Google Workspace account // before responding and logs it to the console. const login = form.requiresLogin(); console.log(login);
Return
Boolean
: true
, wenn Nutzer sich für das Formular anmelden müssen; false
, wenn dies nicht der Fall ist.
setAcceptingResponses(enabled)
Legt fest, ob das Formular derzeit Antworten akzeptiert. Der Standardwert für neue Formulare ist 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());
Parameter
Name | Typ | Beschreibung |
---|---|---|
enabled | Boolean | true , wenn das Formular Antworten annehmen soll; false , wenn nicht. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setAllowResponseEdits(enabled)
Legt fest, ob im Formular ein Link zum Bearbeiten einer Antwort nach dem Senden angezeigt wird. Der Standardwert für neue Formulare ist false
.
Unabhängig von dieser Einstellung ermöglicht die Methode FormResponse.getEditResponseUrl()
einem Skriptautor, der eine Bearbeitungsberechtigung für das Formular hat, eine URL, die zum Bearbeiten einer Antwort verwendet werden kann.
// 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());
Parameter
Name | Typ | Beschreibung |
---|---|---|
enabled | Boolean | true , wenn im Formular ein Link „Antwort bearbeiten“ angezeigt werden soll; false , wenn nicht. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setCollectEmail(collect)
Legt fest, ob im Formular die E-Mail-Adressen der Befragten erfasst werden. Die Standardeinstellung für neue Formulare ist 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);
Parameter
Name | Typ | Beschreibung |
---|---|---|
collect | Boolean | true , wenn mit dem Formular E-Mail-Adressen erfasst werden sollen; false , wenn nicht. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setConfirmationMessage(message)
Legt die Bestätigungsnachricht des Formulars fest.
// 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);
Parameter
Name | Typ | Beschreibung |
---|---|---|
message | String | Die neue Bestätigungsnachricht für das Formular. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setCustomClosedFormMessage(message)
Legt fest, dass die Nachricht angezeigt wird, wenn das Formular keine Antworten akzeptiert. Wenn keine Nachricht festgelegt ist, verwendet das Formular eine Standardnachricht.
// 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);
Parameter
Name | Typ | Beschreibung |
---|---|---|
message | String | Diese Meldung wird angezeigt, wenn das Formular keine Antworten akzeptiert. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setDescription(description)
Legt die Beschreibung des Formulars fest.
Parameter
Name | Typ | Beschreibung |
---|---|---|
description | String | Die neue Beschreibung des Formulars. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setDestination(type, id)
Legt das Ziel fest, an dem die Formularantworten gespeichert werden. In allen Formularen, einschließlich derer, für die kein Ziel explizit festgelegt wurde, speichern Sie eine Kopie der Antworten im Antwortspeicher des Formulars.
Parameter
Name | Typ | Beschreibung |
---|---|---|
type | DestinationType | Der Typ des Antwortziels des Formulars. |
id | String | Die ID des Antwortziels des Formulars. |
Return
Form
: Dieses Form
für Verkettungen.
Löst aus
Error
: wenn die angegebene Ziel-ID ungültig ist
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setIsQuiz(enabled)
Legt fest, ob das Formular ein Quiz ist. Der Standardwert für neue Formulare ist false
.
Benotete Fragen sind nur in Quizzen zulässig. Wenn Sie diesen Wert auf false
setzen, werden also alle Benotungsoptionen aus allen Fragen entfernt.
Quizeinstellungen sind nur in der neuen Benutzeroberfläche für Formulare verfügbar. Wenn Sie ein Formular für ein Quiz erstellen, wird es in der neuen Benutzeroberfläche verwendet.
// 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());
Parameter
Name | Typ | Beschreibung |
---|---|---|
enabled | Boolean | true , wenn Quizfunktionen für das Formular aktiviert werden sollen, andernfalls false . |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setLimitOneResponsePerUser(enabled)
Legt fest, ob im Formular nur eine Antwort pro Teilnehmer zulässig ist. Die Standardeinstellung für neue Formulare ist false
. Wenn der Wert auf true
gesetzt ist, kann das Skript keine Formularantworten senden.
Parameter
Name | Typ | Beschreibung |
---|---|---|
enabled | Boolean | true , wenn das Formular nur eine Antwort pro Teilnehmer zulassen soll; false , wenn nicht. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setProgressBar(enabled)
Legt fest, ob das Formular eine Fortschrittsanzeige hat. Der Standardwert für neue Formulare ist 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());
Parameter
Name | Typ | Beschreibung |
---|---|---|
enabled | Boolean | true , wenn das Formular einen Fortschrittsbalken anzeigt; false , wenn nicht. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setPublishingSummary(enabled)
Legt fest, ob im Formular ein Link angezeigt wird, über den eine Zusammenfassung der Antworten aufgerufen werden kann, nachdem ein Teilnehmer das Formular gesendet hat. Der Standardwert für neue Formulare ist false
.
Parameter
Name | Typ | Beschreibung |
---|---|---|
enabled | Boolean | true , wenn im Formular der Link „Vorherige Antworten anzeigen“ angezeigt werden soll; false , wenn nicht. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setRequireLogin(requireLogin)
Legt fest, ob sich Umfrageteilnehmer in einem Konto in derselben Domain oder einer Subdomain anmelden müssen, bevor sie antworten. Die Standardeinstellung für neue Formulare ist false
, es sei denn, ein Domainadministrator ändert die Standardeinstellung.
Diese Funktion ist nur für Formulare verfügbar, die von Google Workspace-Nutzern erstellt wurden. Nutzer anderer Arten von Google-Konten müssen sich nicht anmelden.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Sets the form so that users must log in to their Google Workspace account. form.setRequireLogin(true); // Checks whether the form requires login or not and logs it to the console. console.log(form.requiresLogin());
Parameter
Name | Typ | Beschreibung |
---|---|---|
requireLogin | Boolean | true , wenn für das Formular eine Anmeldung erforderlich ist; false , wenn dies nicht der Fall ist. |
Return
Form
: Die aktuelle Form (für die Verkettung).
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setShowLinkToRespondAgain(enabled)
Legt fest, ob im Formular ein Link zum Senden einer weiteren Antwort angezeigt wird, nachdem ein Befragter das Formular ausgefüllt hat. Der Standardwert für neue Formulare ist true
.
Parameter
Name | Typ | Beschreibung |
---|---|---|
enabled | Boolean | true , wenn im Formular der Link „Weitere Antwort senden“ angezeigt werden soll; false , wenn nicht. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setShuffleQuestions(shuffle)
Legt fest, ob die Fragen auf den einzelnen Seiten des Formulars zufällig angeordnet werden.
Parameter
Name | Typ | Beschreibung |
---|---|---|
shuffle | Boolean | true , wenn die Reihenfolge der Fragen auf jeder Seite des Formulars zufällig angeordnet werden soll; false , wenn nicht. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setTitle(title)
Legt den Titel des Formulars fest.
Parameter
Name | Typ | Beschreibung |
---|---|---|
title | String | Der neue Titel des Formulars. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
shortenFormUrl(url)
Wandelt eine lange URL für ein Formular in eine kurze URL um. Löst eine Ausnahme aus, wenn die lange URL nicht zu Google Formulare gehört.
Parameter
Name | Typ | Beschreibung |
---|---|---|
url | String | Die zu kürzende URL. |
Return
String
: Eine URL im Format http://goo.gl/forms/1234
.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
submitGrades(responses)
Übermittelt Noten für die angegebenen FormResponses.
Wenn Ihr Code einen onFormSubmit
-Trigger enthält, wird durch den Aufruf von submitGrades()
die onFormSubmit
-Bedingung ausgelöst und eine Endlosschleife verursacht. Um die Endlosschleife zu verhindern, fügen Sie Code hinzu, der prüft, ob die Noten bereits vorhanden sind, bevor submitGrades()
aufgerufen wird.
Parameter
Name | Typ | Beschreibung |
---|---|---|
responses | FormResponse[] | Ein Array aller Antworten des Formulars. |
Return
Form
: Dieses Form
für Verkettungen.
Autorisierung
Skripts, die diese Methode verwenden, erfordern eine Autorisierung mit einem oder mehreren der folgenden Bereiche:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms