Ein Formular, das allgemeine Eigenschaften und Elemente enthält. Zu den Eigenschaften gehören Titel, Einstellungen und der Speicherort der Antworten. Zu den Elementen gehören Frageelemente wie Kästchen oder Optionsfelder, während sich Layout-Elemente auf Dinge wie Seitenumbrüche beziehen. Über FormApp können Sie auf Formulare zugreifen oder sie erstellen.
// 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());
Methoden
| Methode | Rückgabetyp | Kurzbeschreibung |
|---|---|---|
add | Checkbox | Fügt ein neues Frageelement ein, das als Raster aus Spalten und Zeilen dargestellt wird. Der Teilnehmer kann in jeder Zeile mehrere Optionen aus einer Reihe von Kästchen auswählen. |
add | Checkbox | Fügt ein neues Frageelement hinzu, in dem der Teilnehmer ein oder mehrere Kästchen sowie optional ein Feld „Sonstiges“ auswählen kann. |
add | Date | Fügt ein neues Frageelement hinzu, in dem der Befragte ein Datum angeben kann. |
add | Date | Fügt ein neues Frageelement hinzu, in dem der Befragte ein Datum und eine Uhrzeit angeben kann. |
add | Duration | Fügt ein neues Frageelement hinzu, mit dem der Teilnehmer einen Zeitraum angeben kann. |
add | Form | Fügt den angegebenen Nutzer der Liste der Bearbeiter für die Form hinzu. |
add | Form | Fügt den angegebenen Nutzer der Liste der Bearbeiter für die Form hinzu. |
add | Form | Fügt das angegebene Nutzer-Array der Liste der Bearbeiter für Form hinzu. |
add | Grid | Fügt ein neues Frageelement hinzu, das als Raster aus Spalten und Zeilen dargestellt wird. Der Teilnehmer kann pro Zeile eine Option aus einer Reihe von Optionsfeldern auswählen. |
add | Image | Fügt ein neues Layout-Element hinzu, in dem ein Bild angezeigt wird. |
add | List | Fügt ein neues Frageelement hinzu, mit dem der Befragte eine Option aus einer Drop-down-Liste auswählen kann. |
add | Multiple | Fügt ein neues Frageelement hinzu, mit dem der Befragte eine Option aus einer Liste von Optionsfeldern oder ein optionales Feld „Sonstiges“ auswählen kann. |
add | Page | Fügt ein neues Layoutelement hinzu, das den Beginn einer Seite markiert. |
add | Paragraph | Fügt eine neue Frage hinzu, in der der Befragte einen Textblock eingeben kann. |
add | Form | Fügt den angegebenen Nutzer der Liste der Antwortenden für die Form hinzu. |
add | Form | Fügt den angegebenen Nutzer der Liste der Antwortenden für die Form hinzu. |
add | Form | Fügt das angegebene Nutzer-Array der Liste der Antwortenden für Form hinzu. |
add | Rating | Fügt ein neues Frageelement hinzu, mit dem der Befragte eine Bewertung abgeben kann. |
add | Scale | Fügt ein neues Frageelement hinzu, mit dem der Umfrageteilnehmer eine Option aus einer nummerierten Reihe von Optionsfeldern auswählen kann. |
add | Section | Fügt ein neues Layoutelement hinzu, das den Beginn eines Abschnitts visuell kennzeichnet. |
add | Text | Fügt ein neues Frageelement hinzu, in dem der Befragte eine einzelne Textzeile eingeben kann. |
add | Time | Fügt ein neues Frageelement hinzu, mit dem der Teilnehmer eine Tageszeit angeben kann. |
add | Video | Fügt ein neues Layout-Element hinzu, in dem ein Video angezeigt wird. |
can | Boolean | Bestimmt, ob im Formular nach dem Senden einer Antwort ein Link zum Bearbeiten der Antwort angezeigt wird. |
collects | Boolean | Gibt an, ob im Formular die E‑Mail-Adressen der Umfrageteilnehmer erfasst werden. |
create | Form | Erstellt eine neue Antwort auf das Formular. |
delete | Form | Löscht alle eingereichten Antworten aus dem Antwortspeicher des Formulars. |
delete | void | Löscht das Element an einem bestimmten Index unter allen Elementen im Formular. |
delete | void | Löscht das angegebene Element. |
delete | Form | Löscht eine einzelne Antwort aus dem Antwortspeicher des Formulars. |
get | String | Ruft die Bestätigungsnachricht des Formulars ab. |
get | String | Ruft die benutzerdefinierte Nachricht ab, die angezeigt wird, wenn für das Formular keine Antworten mehr angenommen werden, oder einen leeren String, wenn keine benutzerdefinierte Nachricht festgelegt ist. |
get | String | Ruft die Beschreibung des Formulars ab. |
get | String | Ruft die ID des Antwortziels des Formulars ab. |
get | Destination | Gibt den Typ des Antwortziels des Formulars zurück. |
get | String | Ruft die URL ab, über die auf den Bearbeitungsmodus des Formulars zugegriffen werden kann. |
get | User[] | Ruft die Liste der Mitbearbeiter für diese Form ab. |
get | String | Ruft die ID des Formulars ab. |
get | Item|null | Ruft das Element mit einer bestimmten ID ab. |
get | Item[] | Ruft ein Array aller Elemente im Formular ab. |
get | Item[] | Ruft ein Array aller Elemente eines bestimmten Typs ab. |
get | User[] | Ruft die Liste der Antworten für diese Form ab. |
get | String | Ruft die URL ab, die zum Beantworten des Formulars verwendet werden kann. |
get | Form | Ruft eine einzelne Formularantwort anhand ihrer Antwort-ID ab. |
get | Form | Ruft ein Array mit allen Antworten des Formulars ab. |
get | Form | Ruft ein Array aller Antworten des Formulars nach einem bestimmten Datum und einer bestimmten Uhrzeit ab. |
get | Boolean | Gibt an, ob die Reihenfolge der Fragen auf jeder Seite des Formulars zufällig ist. |
get | String | Ruft die URL ab, die zum Aufrufen einer Zusammenfassung der Antworten des Formulars verwendet werden kann. |
get | String | Ruft den Titel des Formulars ab. |
has | Boolean | Gibt an, ob das Formular nur eine Antwort pro Teilnehmer zulässt. |
has | Boolean | Legt fest, ob im Formular eine Fortschrittsanzeige zu sehen ist. |
has | Boolean | Bestimmt, ob im Formular ein Link zum Senden einer weiteren Antwort angezeigt wird, nachdem ein Teilnehmer das Formular ausgefüllt hat. |
is | Boolean | Gibt an, ob für das Formular derzeit Antworten angenommen werden. |
is | Boolean | Gibt an, ob das Formular veröffentlicht ist. |
is | Boolean | Gibt an, ob im Formular ein Link zum Aufrufen einer Zusammenfassung der Antworten angezeigt wird, nachdem ein Teilnehmer das Formular ausgefüllt hat. |
is | Boolean | Gibt an, ob es sich bei dem Formular um ein Quiz handelt. |
move | Item | Verschiebt ein Element an einem bestimmten Index unter allen Elementen im Formular an einen anderen bestimmten Index. |
move | Item | Verschiebt ein bestimmtes Element an einen bestimmten Index unter allen Elementen im Formular. |
remove | Form | Hebt die Verknüpfung des Formulars mit dem aktuellen Antwortziel auf. |
remove | Form | Entfernt den angegebenen Nutzer aus der Liste der Mitbearbeiter für die Form. |
remove | Form | Entfernt den angegebenen Nutzer aus der Liste der Mitbearbeiter für die Form. |
remove | Form | Entfernt den angegebenen Nutzer aus der Liste der Antwortenden für die Form. |
remove | Form | Entfernt den angegebenen Nutzer aus der Liste der Antwortenden für die Form. |
set | Form | Legt fest, ob für das Formular derzeit Antworten angenommen werden. |
set | Form | Legt fest, ob im Formular nach dem Senden einer Antwort ein Link zum Bearbeiten der Antwort angezeigt wird. |
set | Form | Legt fest, ob im Formular die E‑Mail-Adressen der Befragten erfasst werden. |
set | Form | Legt die Bestätigungsnachricht des Formulars fest. |
set | Form | Legt die Meldung fest, die angezeigt werden soll, wenn für das Formular keine Antworten akzeptiert werden. |
set | Form | Legt die Beschreibung des Formulars fest. |
set | Form | Legt das Ziel fest, in dem Formularantworten gespeichert werden. |
set | Form | Legt fest, ob das Formular ein Quiz ist. |
set | Form | Legt fest, ob das Formular nur eine Antwort pro Antwortgeber zulässt. |
set | Form | Legt fest, ob das Formular eine Fortschrittsanzeige hat. |
set | Form | Legt fest, ob das Formular veröffentlicht wird. |
set | Form | Legt fest, ob im Formular ein Link zum Aufrufen einer Zusammenfassung der Antworten angezeigt wird, nachdem ein Teilnehmer das Formular gesendet hat. |
set | Form | Legt fest, ob im Formular ein Link zum Senden einer weiteren Antwort angezeigt wird, nachdem ein Teilnehmer das Formular ausgefüllt hat. |
set | Form | Legt fest, ob die Reihenfolge der Fragen auf jeder Seite des Formulars zufällig ist. |
set | Form | Legt den Titel des Formulars fest. |
shorten | String | Wandelt eine lange URL für ein Formular in eine kurze URL um. |
submit | Form | Reicht Noten für die angegebenen FormResponses ein. |
supports | Boolean | Gibt an, ob das Formular die Veröffentlichung unterstützt. |
Detaillierte Dokumentation
addCheckboxGridItem()
Fügt ein neues Frageelement ein, das als Raster aus Spalten und Zeilen dargestellt wird. Der Teilnehmer kann in jeder Zeile mehrere Optionen aus einer Reihe von Kästchen auswählen.
// 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' ]);
Rückflug
CheckboxGridItem: Das neu erstellte Element.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addCheckboxItem()
Fügt ein neues Frageelement hinzu, in dem der Teilnehmer ein oder mehrere Kästchen sowie optional ein 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']);
Rückflug
CheckboxItem: Das neu erstellte Element.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addDateItem()
Fügt ein neues Frageelement hinzu, in dem der Befragte 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.');
Rückflug
DateItem: Das neu erstellte Element.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addDateTimeItem()
Fügt ein neues Frageelement hinzu, in dem der Befragte 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);
Rückflug
DateTimeItem: Das neu erstellte Element.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addDurationItem()
Fügt ein neues Frageelement hinzu, mit dem der Teilnehmer einen Zeitraum 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);
Rückflug
DurationItem: Das neu erstellte Element.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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 die Form hinzu. Wenn der Nutzer bereits in der Liste der Zuschauer oder Antwortenden enthalten war, wird er durch diese Methode aus der Liste entfernt.
// 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');
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
email | String | Die E-Mail-Adresse des Nutzers, den Sie hinzufügen möchten. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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 die Form hinzu. Wenn der Nutzer bereits in der Liste der Zuschauer oder Antwortenden enthalten war, wird er durch diese Methode aus der Liste entfernt.
// 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));
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
user | User | Eine Darstellung des hinzuzufügenden Nutzers. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addEditors(emailAddresses)
Fügt das angegebene Nutzer-Array der Liste der Bearbeiter für Form hinzu. Wenn einer der Nutzer bereits in der Liste der Zuschauer war, wird er durch diese Methode aus der Liste der Zuschauer entfernt.
// 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']);
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
email | String[] | Ein Array mit den E‑Mail-Adressen der Nutzer, die hinzugefügt werden sollen. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addGridItem()
Fügt ein neues Frageelement hinzu, das als Raster aus Spalten und Zeilen dargestellt wird. Der Teilnehmer kann pro Zeile eine Option aus einer Reihe von Optionsfeldern auswählen.
// 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' ]);
Rückflug
GridItem: Das neu erstellte Element.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addImageItem()
Fügt ein neues Layout-Element hinzu, in dem ein Bild 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. // 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);
Rückflug
ImageItem: Das neu erstellte Element.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addListItem()
Fügt ein neues Frageelement hinzu, mit dem der Befragte eine Option 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')]);
Rückflug
ListItem: Das neu erstellte Element.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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 Option aus einer Liste von Optionsfeldern oder 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 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]);
Rückflug
MultipleChoiceItem: Das neu erstellte Element.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addPageBreakItem()
Fügt ein neues Layoutelement hinzu, das den Beginn 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);
Rückflug
PageBreakItem: Das neu erstellte Element.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addParagraphTextItem()
Fügt eine neue Frage hinzu, in der der Befragte 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?');
Rückflug
ParagraphTextItem: Das neu erstellte Element.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addPublishedReader(emailAddress)
Fügt den angegebenen Nutzer der Liste der Antwortenden für die Form hinzu. Wenn der Nutzer bereits in der Liste der Bearbeiter oder Betrachter enthalten war, 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'); // Adds responder to the form. // TODO(developer): replace the emailAddress. form.addPublishedReader('responder@uni.edu');
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
email | String | Die E-Mail-Adresse des Nutzers, den Sie hinzufügen möchten. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addPublishedReader(user)
Fügt den angegebenen Nutzer der Liste der Antwortenden für die Form hinzu. Wenn der Nutzer bereits in der Liste der Bearbeiter oder Betrachter enthalten war, hat diese Methode keine Auswirkungen.
// 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));
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
user | User | Eine Darstellung des hinzuzufügenden Nutzers. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addPublishedReaders(emailAddresses)
Fügt das angegebene Nutzer-Array der Liste der Antwortenden für Form hinzu. Wenn der Nutzer bereits in der Liste der Bearbeiter oder Betrachter enthalten war, 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'); // Adds responders to the form. // TODO(developer): replace the emailAddress. form.addPublishedReaders(['responder1@uni.edu', 'responder2@uni.edu']);
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
email | String[] | Ein Array mit den E‑Mail-Adressen der Nutzer, die hinzugefügt werden sollen. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addRatingItem()
Fügt ein neues Frageelement hinzu, mit dem der Befragte eine Bewertung abgeben 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 rating item. const item = form.addRatingItem();
Rückflug
RatingItem: Das neu erstellte Element.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addScaleItem()
Fügt ein neues Frageelement hinzu, mit dem der Umfrageteilnehmer eine Option aus einer nummerierten 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 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');
Rückflug
ScaleItem: Das neu erstellte Element.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addSectionHeaderItem()
Fügt ein neues Layoutelement hinzu, das den Beginn eines Abschnitts visuell kennzeichnet.
// 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');
Rückflug
SectionHeaderItem: Das neu erstellte Element.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addTextItem()
Fügt ein neues Frageelement hinzu, in dem der Befragte 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?');
Rückflug
TextItem: Das neu erstellte Element.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addTimeItem()
Fügt ein neues Frageelement hinzu, mit dem 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?');
Rückflug
TimeItem: Das neu erstellte Element.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addVideoItem()
Fügt ein neues Layout-Element hinzu, in dem ein Video 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. // 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);
Rückflug
VideoItem: Das neu erstellte Element.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
canEditResponse()
Bestimmt, ob im Formular nach dem Senden einer Antwort ein Link zum Bearbeiten der Antwort angezeigt wird.
Unabhängig von dieser Einstellung kann ein Scriptautor mit Bearbeitungszugriff auf das Formular mit der Methode FormResponse.getEditResponseUrl() eine URL generieren, 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);
Rückflug
Boolean – true, wenn im Formular der Link „Antwort bearbeiten“ angezeigt wird; false, wenn nicht.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
collectsEmail()
Gibt an, ob im Formular die E‑Mail-Adressen der Umfrageteilnehmer 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);
Rückflug
Boolean – true, wenn im Formular E‑Mail-Adressen erfasst werden, false, wenn nicht.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
createResponse()
Erstellt eine neue Antwort auf das Formular. Um eine Frage zu beantworten, erstellen Sie ein ItemResponse aus dem Element und hängen Sie es an diese Antwort an, indem Sie FormResponse.withItemResponse(response) aufrufen. Rufen Sie FormResponse.submit() auf, um die zusammengestellte Antwort zu speichern.
Rückflug
FormResponse: Die neu erstellte Formularantwort.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
deleteAllResponses()
Löscht alle eingereichten Antworten aus dem Antwortspeicher des Formulars. Bei dieser Methode werden keine Kopien von Antworten gelöscht, die in einem externen Antwortziel (z. B. einer Tabelle) gespeichert sind. Die Zusammenfassungsansicht des Formulars wird jedoch geleert.
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
deleteItem(index)
Löscht das Element an einem bestimmten Index unter allen Elementen im Formular. Löst eine Scripting-Ausnahme aus, wenn am 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 | Der Index des Elements unter allen Elementen im Formular. |
Löst
Error – wenn am angegebenen Index kein Element vorhanden ist
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
deleteItem(item)
Löscht das angegebene Element. Löst eine Scripting-Ausnahme 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
Error: wenn das Element nicht im Formular vorhanden ist
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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. Mit dieser Methode werden keine Kopien von Antworten gelöscht, die an einem externen Ziel für Antworten (z. B. eine Tabelle) gespeichert sind. Die Antwort wird jedoch aus der Zusammenfassungsansicht des Formulars entfernt. Die Antwort-ID kann mit FormResponse.getId() abgerufen werden.
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
response | String | Die ID der zu löschenden Formularantwort. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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);
Rückflug
String: Die Bestätigungsnachricht des Formulars.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getCustomClosedFormMessage()
Ruft die benutzerdefinierte Nachricht ab, die angezeigt wird, wenn für das Formular keine Antworten mehr angenommen werden, oder einen leeren String, wenn keine benutzerdefinierte Nachricht festgelegt 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 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);
Rückflug
String: Die benutzerdefinierte Nachricht, die angezeigt werden soll, wenn für das Formular keine Antworten mehr angenommen werden, oder ein leerer String, wenn keine benutzerdefinierte Nachricht festgelegt ist.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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);
Rückflug
String: Die Beschreibung des Formulars.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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);
Rückflug
String: Die ID des Antwortziels des Formulars.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getDestinationType()
Gibt den Typ des Antwortziels des Formulars zurück.
// 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);
Rückflug
DestinationType: Der Typ des Antwortziels des Formulars.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getEditUrl()
Ruft die URL ab, über die auf den Bearbeitungsmodus des Formulars zugegriffen 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);
Rückflug
String: Die URL zum Bearbeiten des Formulars.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getEditors()
Ruft die Liste der Mitbearbeiter für diese Form ab.
Rückflug
User[]: Ein Array von Nutzern mit Bearbeitungsberechtigung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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);
Rückflug
String: Die ID des Formulars.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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. |
Rückflug
Item|null: Das Element mit der angegebenen ID oder null, wenn das Element nicht im Formular vorhanden ist.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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);
Rückflug
Item[]: Ein Array mit allen Elementen im Formular.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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 |
|---|---|---|
item | Item | Der Typ der abzurufenden Elemente. |
Rückflug
Item[]: Ein Array aller Elemente dieses Typs.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getPublishedReaders()
Ruft die Liste der Antworten für diese Form 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 responders for the form. const users = form.getPublishedReaders(); users.forEach(user => console.log(user.getEmail()));
Rückflug
User[]: Ein Array von Nutzern mit der Berechtigung „Antworten“.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getPublishedUrl()
Ruft die URL ab, die zum Beantworten 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);
Rückflug
String: Die URL, über die das Formular ausgefüllt werden kann.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getResponse(responseId)
Ruft eine einzelne Formularantwort anhand ihrer Antwort-ID ab. Antwort-IDs können über FormResponse.getId() abgerufen werden.
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
response | String | Die ID der Formularantwort. |
Rückflug
FormResponse: Die Formularantwort.
Löst
Error: wenn die Antwort nicht vorhanden ist
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getResponses()
Ruft ein Array mit allen Antworten des Formulars ab.
Rückflug
FormResponse[]: Ein Array mit allen Antworten des Formulars.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getResponses(timestamp)
Ruft ein Array aller Antworten des Formulars nach einem bestimmten Datum und einer bestimmten Uhrzeit ab.
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
timestamp | Date | Das früheste Datum und die früheste Uhrzeit, für die Formularantworten zurückgegeben werden sollen. |
Rückflug
FormResponse[]: Die Liste der Formularantworten.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getShuffleQuestions()
Gibt an, ob die Reihenfolge der Fragen auf jeder Seite des Formulars zufällig ist.
Rückflug
Boolean – true, wenn die Reihenfolge der Fragen auf jeder Seite des Formulars zufällig ist;
false, wenn nicht.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getSummaryUrl()
Ruft die URL ab, die zum Aufrufen einer Zusammenfassung der Antworten des Formulars verwendet werden kann. Sofern setPublishingSummary(enabled) nicht auf true festgelegt ist, können nur Nutzer mit Bearbeitungsberechtigung für das Formular auf die URL zugreifen.
// 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);
Rückflug
String: Die URL, über die eine Zusammenfassung der Antworten aufgerufen werden kann.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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);
Rückflug
String: Der Titel des Formulars.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
hasLimitOneResponsePerUser()
Gibt an, ob das Formular nur eine Antwort pro Teilnehmer zulässt. Wenn der Wert true ist, kann das Skript überhaupt keine Formularantworten senden.
Rückflug
Boolean – true, wenn im Formular nur eine Antwort pro Befragtem zulässig ist, false, wenn nicht.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
hasProgressBar()
Legt fest, ob im Formular eine Fortschrittsanzeige zu sehen 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. // 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());
Rückflug
Boolean – true, wenn im Formular eine Fortschrittsanzeige zu sehen ist; false, wenn nicht.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
hasRespondAgainLink()
Bestimmt, 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());
Rückflug
Boolean – true, wenn im Formular der Link „Weitere Antwort senden“ angezeigt wird; false, wenn dies nicht der Fall ist.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
isAcceptingResponses()
Gibt an, ob für das Formular derzeit Antworten angenommen werden. Dieser Wert wird überschrieben, wenn sich der Veröffentlichungsstatus des Formulars ändert.
// 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);
Rückflug
Boolean – true, wenn für das Formular Antworten angenommen werden, false, wenn nicht.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
isPublished()
Gibt an, ob das Formular veröffentlicht ist.
Diese Funktion ist nur für Formulare verfügbar, die die Veröffentlichung unterstützen. Verwenden Sie supportsAdvancedResponderPermissions(), um zu prüfen, ob das Formular die Veröffentlichung unterstützt.
// 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());
Rückflug
Boolean – true, wenn das Formular veröffentlicht ist, false, wenn nicht.
Löst
Error – wenn er für nicht unterstützte Formulare aufgerufen wird.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
isPublishingSummary()
Gibt an, ob im Formular ein Link zum Aufrufen einer Zusammenfassung der Antworten 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 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);
Rückflug
Boolean – true, wenn im Formular der Link „Vorherige Antworten ansehen“ angezeigt wird; false, wenn dies nicht der Fall ist.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
isQuiz()
Gibt an, ob es sich bei dem Formular um ein Quiz handelt.
// 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());
Rückflug
Boolean – true, wenn für das Formular Antworten angenommen werden, false, wenn nicht.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
moveItem(from, to)
Verschiebt ein Element an einem bestimmten Index unter allen Elementen im Formular an einen anderen bestimmten Index. Löst eine Scripting-Ausnahme aus, wenn der to-Index außerhalb des zulässigen 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. |
Rückflug
Item: Das Element, das verschoben wurde.
Löst
Error: wenn einer der beiden Indexe außerhalb des zulässigen Bereichs liegt.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
moveItem(item, toIndex)
Verschiebt ein bestimmtes Element an einen bestimmten Index unter allen Elementen im Formular. Löst eine Scripting-Ausnahme aus, wenn der angegebene Index außerhalb des zulässigen 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. |
to | Integer | Der neue Index für das Element unter allen Elementen im Formular. |
Rückflug
Item: Das Element, das verschoben wurde.
Löst
Error: Wenn der Index außerhalb des zulässigen Bereichs liegt.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
removeDestination()
Hebt die Verknüpfung des Formulars mit dem aktuellen Antwortziel auf. Das nicht verknüpfte frühere Ziel behält weiterhin eine Kopie aller vorherigen Antworten. In allen Formularen, auch in denen, für die kein Ziel explizit festgelegt ist, wird eine Kopie der Antworten im Antwortspeicher des Formulars gespeichert. 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();
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
removeEditor(emailAddress)
Entfernt den angegebenen Nutzer aus der Liste der Mitbearbeiter für die Form. Mit dieser Methode wird der Zugriff auf das Form nicht für Nutzer blockiert, die einer Nutzerklasse mit allgemeinem Zugriff angehören. Das ist beispielsweise der Fall, wenn das Form für die gesamte Domain des Nutzers freigegeben ist oder sich das Form in einer geteilten Ablage befindet, auf die der Nutzer zugreifen kann.
Bei Drive-Dateien wird der Nutzer dadurch auch aus der Liste der Betrachter und Antwortenden entfernt.
// 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');
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
email | String | Die E‑Mail-Adresse des Nutzers, der entfernt werden soll. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
removeEditor(user)
Entfernt den angegebenen Nutzer aus der Liste der Mitbearbeiter für die Form. Mit dieser Methode wird der Zugriff auf das Form nicht für Nutzer blockiert, die einer Nutzerklasse mit allgemeinem Zugriff angehören. Das ist beispielsweise der Fall, wenn das Form für die gesamte Domain des Nutzers freigegeben ist oder sich das Form in einer geteilten Ablage befindet, auf die der Nutzer zugreifen kann.
Bei Drive-Dateien wird der Nutzer dadurch auch aus der Liste der Betrachter entfernt.
// 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));
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
user | User | Eine Darstellung des zu entfernenden Nutzers. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
removePublishedReader(emailAddress)
Entfernt den angegebenen Nutzer aus der Liste der Antwortenden für die Form. Mit dieser Methode wird der Zugriff auf die Form nicht für Nutzer blockiert, die einer Nutzerklasse mit allgemeinem Zugriff angehören. Das ist beispielsweise der Fall, wenn die Form für die gesamte Domain des Nutzers freigegeben ist oder sich die Form in einer geteilten Ablage befindet, auf die der Nutzer zugreifen kann.
Bei Drive-Dateien wird der Nutzer dadurch auch aus der Liste der Betrachter und Mitbearbeiter entfernt.
// 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');
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
email | String | Die E‑Mail-Adresse des Nutzers, der entfernt werden soll. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
removePublishedReader(user)
Entfernt den angegebenen Nutzer aus der Liste der Antwortenden für die Form. Mit dieser Methode wird der Zugriff auf die Form nicht für Nutzer blockiert, die einer Nutzerklasse mit allgemeinem Zugriff angehören. Das ist beispielsweise der Fall, wenn die Form für die gesamte Domain des Nutzers freigegeben ist oder sich die Form in einer geteilten Ablage befindet, auf die der Nutzer zugreifen kann.
Bei Drive-Dateien wird der Nutzer dadurch auch aus der Liste der Betrachter und Mitbearbeiter entfernt.
// 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));
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
user | User | Eine Darstellung des zu entfernenden Nutzers. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setAcceptingResponses(enabled)
Legt fest, ob für das Formular derzeit Antworten angenommen werden. Der Standardwert für neue Formulare ist true. Der Status wird überschrieben, wenn sich der Veröffentlichungsstatus des Formulars ändert.
// 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 für das Formular Antworten angenommen werden sollen, false, wenn nicht. |
Rückflug
Form – Diese Form zur Verkettung.
Löst
Error – wenn für ein nicht veröffentlichtes Formular aktiviert.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setAllowResponseEdits(enabled)
Legt fest, ob im Formular nach dem Senden einer Antwort ein Link zum Bearbeiten der Antwort angezeigt wird. Der Standardwert für neue Formulare ist false.
Unabhängig von dieser Einstellung kann ein Skriptautor, der die Berechtigung zum Bearbeiten des Formulars hat, mit der Methode FormResponse.getEditResponseUrl() eine URL generieren, 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', ); // 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 der Link „Antwort bearbeiten“ angezeigt werden soll, false, wenn nicht. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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. 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', ); // 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 im Formular E‑Mail-Adressen erfasst werden sollen, false, wenn nicht. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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 des Formulars. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setCustomClosedFormMessage(message)
Legt die Meldung fest, die angezeigt werden soll, wenn für das Formular keine Antworten akzeptiert werden. Wenn keine Nachricht festgelegt ist, wird im Formular eine Standardnachricht 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', ); // 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 | Die Meldung, die angezeigt werden soll, wenn für das Formular keine Antworten angenommen werden. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setDestination(type, id)
Legt das Ziel fest, in dem Formularantworten gespeichert werden. Für alle Formulare, auch für solche, für die kein Ziel explizit festgelegt ist, wird eine Kopie der Antworten im Antwortspeicher des Formulars gespeichert.
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
type | Destination | Der Typ des Antwortziels des Formulars. |
id | String | Die ID des Antwortziels des Formulars. |
Rückflug
Form – Diese Form zur Verkettung.
Löst
Error: Die angegebene Ziel-ID ist ungültig.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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.
Bewertete Fragen sind nur in Quizzen zulässig. Wenn Sie diese Option auf false setzen, werden alle Bewertungsoptionen aus allen Fragen entfernt.
Quiz-Einstellungen sind nur in der neuen Google Formulare-Benutzeroberfläche verfügbar. Wenn Sie ein Formular in ein Quiz umwandeln, wird die neue Benutzeroberfläche für das Formular 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 die Quizfunktionen für das Formular aktiviert werden sollen, false, wenn nicht. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setLimitOneResponsePerUser(enabled)
Legt fest, ob das Formular nur eine Antwort pro Antwortgeber zulässt. Der Standardwert für neue Formulare ist false. Wenn der Wert auf true gesetzt ist, kann das Script überhaupt keine Formularantworten senden.
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
enabled | Boolean | true, wenn das Formular nur eine Antwort pro Teilnehmer zulassen soll, false, wenn nicht. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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 im Formular eine Fortschrittsanzeige zu sehen ist, false, wenn nicht. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setPublished(enabled)
Legt fest, ob das Formular veröffentlicht wird. Der Standardwert für neue Formulare ist true.
Diese Funktion ist nur für Formulare verfügbar, die die Veröffentlichung unterstützen. Verwenden Sie supportsAdvancedResponderPermissions(), um zu prüfen, ob das Formular die Veröffentlichung unterstützt.
Ein Formular muss veröffentlicht werden, damit es für Teilnehmer zugänglich ist. Diese Methode ersetzt Aufrufe von 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());
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
enabled | Boolean | true, wenn das Formular veröffentlicht werden soll, false, wenn nicht. |
Rückflug
Form – Diese Form zur Verkettung.
Löst
Error – wenn er für nicht unterstützte Formulare aufgerufen wird.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setPublishingSummary(enabled)
Legt fest, ob im Formular ein Link zum Aufrufen einer Zusammenfassung der Antworten angezeigt wird, 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 ansehen“ angezeigt werden soll, false, wenn nicht. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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 Teilnehmer 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. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setShuffleQuestions(shuffle)
Legt fest, ob die Reihenfolge der Fragen auf jeder Seite des Formulars zufällig ist.
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
shuffle | Boolean | true, wenn die Reihenfolge der Fragen auf jeder Seite des Formulars zufällig sein soll, false, wenn nicht. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
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 verkürzende URL. |
Rückflug
String: Eine URL im Format http://goo.gl/forms/1234.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
submitGrades(responses)
Reicht Noten für die angegebenen FormResponses ein.
Wenn Ihr Code einen onFormSubmit-Trigger enthält, wird durch den Aufruf von submitGrades() die onFormSubmit-Bedingung ausgelöst und es kommt zu einer Endlosschleife. Um die Endlosschleife zu verhindern, fügen Sie Code hinzu, der prüft, ob Noten bereits vorhanden sind, bevor Sie submitGrades() aufrufen.
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
responses | Form | Ein Array mit allen Antworten des Formulars. |
Rückflug
Form – Diese Form zur Verkettung.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
supportsAdvancedResponderPermissions()
Gibt an, ob das Formular die Veröffentlichung unterstützt. Mit dieser Methode wird ermittelt, ob die Methoden setPublished(enabled) und isPublished() sowie die Berechtigungen für Antwortende verfügbar sind.
// 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());
Rückflug
Boolean – true, wenn das Formular die Veröffentlichung unterstützt, false, wenn nicht.
Autorisierung
Scripts, die diese Methode verwenden, benötigen eine Autorisierung für mindestens einen der folgenden Zugriffsbereiche:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms