Ein Formular mit allen Eigenschaften und Elementen. Zu den Eigenschaften gehören der Titel, die Einstellungen und der Speicherort der Antworten. Elemente umfassen Fragen wie Kästchen oder Optionsfelder, Layoutelemente beziehen sich jedoch beispielsweise auf Seitenumbrüche. Formulare können über FormApp
aufgerufen oder erstellt werden.
// 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 | Fügt ein neues Frageelement an, das als Raster mit Spalten und Zeilen angezeigt wird, wodurch der Teilnehmer mehrere Möglichkeiten pro Zeile aus einer Reihe von Kästchen auswählen kann. |
addCheckboxItem() | CheckboxItem | Fügt ein neues Frageelement an, mit dem der Teilnehmer ein oder mehrere Kästchen auswählen kann, sowie ein optionales Feld „Sonstiges“. |
addDateItem() | DateItem | Fügt ein neues Frageelement an, mit dem der Teilnehmer ein Datum angeben kann. |
addDateTimeItem() | DateTimeItem | Fügt ein neues Frageelement an, mit dem der Teilnehmer ein Datum und eine Uhrzeit angeben kann. |
addDurationItem() | DurationItem | Fügt ein neues Frageelement an, mit dem der Teilnehmer eine Dauer angeben kann. |
addEditor(emailAddress) | Form | Der entsprechende Nutzer wird der Liste der Mitbearbeiter für Form hinzugefügt. |
addEditor(user) | Form | Der entsprechende Nutzer wird der Liste der Mitbearbeiter für Form hinzugefügt. |
addEditors(emailAddresses) | Form | Fügt das angegebene Array von Nutzern der Liste der Mitbearbeiter für Form hinzu. |
addGridItem() | GridItem | Es wird ein neues Frageelement angehängt und als Raster aus Spalten und Zeilen angezeigt. Dadurch kann der Teilnehmer eine Antwort pro Zeile aus einer Reihe von Optionsfeldern auswählen. |
addImageItem() | ImageItem | Fügt ein neues Layoutelement an, das ein Bild darstellt. |
addListItem() | ListItem | Es wird ein neues Frageelement angehängt, aus dem der Teilnehmer eine Antwort aus einer Drop-down-Liste auswählen kann. |
addMultipleChoiceItem() | MultipleChoiceItem | Fügt ein neues Frageelement hinzu, mit dem der Teilnehmer eine Antwort aus einer Liste mit Optionsfeldern oder einem optionalen Feld „Sonstiges“ auswählen kann. |
addPageBreakItem() | PageBreakItem | Fügt ein neues Layoutelement hinzu, das den Beginn einer Seite markiert. |
addParagraphTextItem() | ParagraphTextItem | Fügt ein neues Frageelement hinzu, mit dem der Teilnehmer einen Textblock eingeben kann. |
addScaleItem() | ScaleItem | Es wird ein neues Frageelement angehängt, aus dem der Teilnehmer eine Option aus einer nummerierten Abfolge von Optionsfeldern auswählen kann. |
addSectionHeaderItem() | SectionHeaderItem | Fügt ein neues Layoutelement an, das den Beginn eines Abschnitts angibt. |
addTextItem() | TextItem | Fügt ein neues Frageelement an, das es dem Teilnehmer ermöglicht, eine einzelne Textzeile einzugeben. |
addTimeItem() | TimeItem | Fügt ein neues Frageelement an, mit dem der Teilnehmer eine Tageszeit angeben kann. |
addVideoItem() | VideoItem | Fügt ein neues Layoutelement an, in dem ein Video angezeigt wird. |
canEditResponse() | Boolean | Legt fest, ob im Formular ein Link zum Bearbeiten einer Antwort angezeigt wird, nachdem er gesendet wurde. |
collectsEmail() | Boolean | Legt fest, ob im Formular die E-Mail-Adressen der Befragten erhoben werden. |
createResponse() | FormResponse | Erstellt eine neue Antwort auf 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 unter 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 akzeptiert. Wenn kein benutzerdefinierter Text festgelegt wurde, wird ein leerer String abgerufen. |
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 auf den Bearbeitungsmodus des Formulars zugegriffen werden kann. |
getEditors() | User[] | Ruft die Liste der Editoren für dieses 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 Antworten auf das Formular verwendet werden kann. |
getResponse(responseId) | FormResponse | Ruft eine einzelne Formularantwort basierend auf ihrer Antwort-ID ab. |
getResponses() | FormResponse[] | Ruft ein Array aller Antworten des Formulars ab |
getResponses(timestamp) | FormResponse[] | Ruft ein Array aller Formularantworten nach einem bestimmten Datum und einer bestimmten Uhrzeit ab. |
getShuffleQuestions() | Boolean | Legt fest, ob die Fragen auf jeder Seite des Formulars zufällig angeordnet sind. |
getSummaryUrl() | String | Ruft die URL ab, mit der eine Zusammenfassung der Formularantworten angesehen werden kann. |
getTitle() | String | Ruft den Titel des Formulars ab |
hasLimitOneResponsePerUser() | Boolean | Legt fest, ob das Formular nur eine Antwort pro Teilnehmer zulässt. |
hasProgressBar() | Boolean | Legt fest, ob im Formular eine Fortschrittsanzeige zu sehen ist. |
hasRespondAgainLink() | Boolean | Legt fest, ob im Formular ein Link zum Senden einer weiteren Antwort angezeigt wird, nachdem der Teilnehmer das Formular ausgefüllt hat. |
isAcceptingResponses() | Boolean | Legt fest, ob das Formular derzeit Antworten akzeptiert. |
isPublishingSummary() | Boolean | Legt fest, ob im Formular ein Link zum Ansehen einer Zusammenfassung der Antworten angezeigt wird, nachdem der Teilnehmer das Formular ausgefüllt hat. |
isQuiz() | Boolean | Legt fest, ob das Formular ein Quiz ist. |
moveItem(from, to) | Item | Verschiebt ein Element an einem bestimmten Index zwischen allen Elementen im Formular in einen anderen Index. |
moveItem(item, toIndex) | Item | Verschiebt ein bestimmtes Element in einen bestimmten Index unter allen Elementen im Formular. |
removeDestination() | Form | Hier können Sie die Verknüpfung des Formulars mit dem aktuellen Antwortziel aufheben. |
removeEditor(emailAddress) | Form | Entfernt den angegebenen Nutzer aus der Liste der Mitbearbeiter für Form . |
removeEditor(user) | Form | Entfernt den angegebenen Nutzer aus der Liste der Mitbearbeiter für Form . |
requiresLogin() | Boolean | Legt fest, ob sich die Teilnehmer am Formular in einem Konto in derselben Domain oder 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 angezeigt wird, um eine Antwort nach dem Senden zu bearbeiten. |
setCollectEmail(collect) | Form | Legt fest, ob im Formular die E-Mail-Adressen der Befragten erhoben werden. |
setConfirmationMessage(message) | Form | Legt die Bestätigungsnachricht für das Formular fest. |
setCustomClosedFormMessage(message) | Form | Die Nachricht wird angezeigt, 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 Formularantworten gespeichert werden sollen. |
setIsQuiz(enabled) | Form | Hier legen Sie fest, ob es sich bei dem Formular um ein Quiz handelt. |
setLimitOneResponsePerUser(enabled) | Form | Legt fest, ob das Formular nur eine Antwort pro Teilnehmer zulässt. |
setProgressBar(enabled) | Form | Legt fest, ob das Formular eine Fortschrittsanzeige hat. |
setPublishingSummary(enabled) | Form | Legt fest, ob im Formular ein Link zum Ansehen der Zusammenfassung der Antworten angezeigt wird, nachdem der Teilnehmer das Formular gesendet hat. |
setRequireLogin(requireLogin) | Form | Gibt an, ob sich die Teilnehmer des Formulars in einem Konto in derselben Domain oder Subdomain anmelden müssen, bevor sie antworten können. |
setShowLinkToRespondAgain(enabled) | Form | Legt fest, ob im Formular ein Link zum Senden einer weiteren Antwort angezeigt wird, nachdem der Teilnehmer das Formular ausgefüllt hat. |
setShuffleQuestions(shuffle) | Form | Legt fest, ob die Reihenfolge der Fragen auf den einzelnen Seiten des Formulars zufällig angeordnet ist. |
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()
Fügt ein neues Frageelement an, das als Raster mit Spalten und Zeilen angezeigt wird, wodurch der Teilnehmer mehrere Mö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']);
Rückflug
CheckboxGridItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addCheckboxItem()
Fügt ein neues Frageelement an, mit dem der Teilnehmer ein oder mehrere Kästchen auswählen kann, sowie ein optionales Feld „Sonstiges“.
// 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
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addDateItem()
Fügt ein neues Frageelement an, mit dem 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.');
Rückflug
DateItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addDateTimeItem()
Fügt ein neues Frageelement an, mit dem 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);
Rückflug
DateTimeItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addDurationItem()
Fügt ein neues Frageelement an, mit dem der Teilnehmer eine Dauer 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
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addEditor(emailAddress)
Der entsprechende Nutzer wird der Liste der Mitbearbeiter für Form
hinzugefügt. Wenn der Nutzer bereits auf der Liste der Betrachter steht, wird er mit dieser Methode aus der Betrachterliste hochgestuft.
Parameter
Name | Typ | Beschreibung |
---|---|---|
emailAddress | String | Die E-Mail-Adresse des Nutzers, den Sie hinzufügen möchten. |
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addEditor(user)
Der entsprechende Nutzer wird der Liste der Mitbearbeiter für Form
hinzugefügt. Wenn der Nutzer bereits auf der Liste der Betrachter steht, wird er mit dieser Methode aus der Betrachterliste hochgestuft.
Parameter
Name | Typ | Beschreibung |
---|---|---|
user | User | Eine Darstellung des hinzuzufügenden Nutzers. |
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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 Mitbearbeiter für Form
hinzu. Wenn einer der Nutzer bereits auf der Liste der Betrachter steht, wird er mit dieser Methode aus der Betrachterliste hochgestuft.
Parameter
Name | Typ | Beschreibung |
---|---|---|
emailAddresses | String[] | Ein Array mit E-Mail-Adressen der hinzuzufügenden Nutzer. |
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addGridItem()
Es wird ein neues Frageelement angehängt und als Raster aus Spalten und Zeilen angezeigt. Dadurch kann der Teilnehmer eine Antwort pro Zeile 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
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addImageItem()
Fügt ein neues Layoutelement an, das ein Bild 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 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
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addListItem()
Es wird ein neues Frageelement angehängt, aus dem der Teilnehmer 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') ]);
Rückflug
ListItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addMultipleChoiceItem()
Fügt ein neues Frageelement hinzu, mit dem der Teilnehmer eine Antwort aus einer Liste mit 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]);
Rückflug
MultipleChoiceItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addParagraphTextItem()
Fügt ein neues Frageelement hinzu, mit dem 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?');
Rückflug
ParagraphTextItem
: Das neu erstellte Element.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addScaleItem()
Es wird ein neues Frageelement angehängt, aus dem der Teilnehmer eine Option aus einer nummerierten Abfolge 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
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addSectionHeaderItem()
Fügt ein neues Layoutelement an, das den Beginn eines Abschnitts angibt.
// 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
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addTextItem()
Fügt ein neues Frageelement an, das es dem Teilnehmer ermöglicht, eine einzelne Textzeile einzugeben.
// 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
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addTimeItem()
Fügt ein neues Frageelement an, 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
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addVideoItem()
Fügt ein neues Layoutelement an, 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
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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 angezeigt wird, nachdem er gesendet wurde.
Unabhängig von dieser Einstellung ermöglicht die Methode FormResponse.getEditResponseUrl()
einem Skriptautor mit Bearbeitungszugriff auf das Formular das Generieren einer 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);
Rückflug
Boolean
: true
, wenn das Formular den Link „Antwort bearbeiten“ anzeigt. Andernfalls false
.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
collectsEmail()
Legt fest, ob im Formular die E-Mail-Adressen der Befragten erhoben 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 mit dem Formular E-Mail-Adressen erfasst werden. Andernfalls false
.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
createResponse()
Erstellt eine neue Antwort auf das Formular. Um ein Frageelement zu beantworten, erstellen Sie ein ItemResponse
aus dem Element und hängen Sie es dann an diese Formularantwort an. Rufen Sie dazu FormResponse.withItemResponse(response)
auf. Rufen Sie FormResponse.submit()
auf, um die zusammengestellte Antwort zu speichern.
Rückflug
FormResponse
: Die neu erstellte Formularantwort.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
deleteAllResponses()
Löscht alle gesendeten Antworten aus dem Antwortspeicher des Formulars. Bei dieser Methode werden keine Kopien von Antworten gelöscht, die in einem externen Antwortziel wie einer Tabelle gespeichert sind, aber es wird die Zusammenfassungsansicht des Formulars gelöscht.
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
deleteItem(index)
Löscht das Element bei einem bestimmten Index unter 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 | Der Index des Elements unter allen Elementen im Formular. |
Löst aus
Error
: wenn im angegebenen Index kein Element vorhanden ist
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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 Element, das gelöscht werden soll. |
Löst aus
Error
: Wenn das Element im Formular nicht vorhanden ist
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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. Bei dieser Methode werden keine Kopien von Antworten gelöscht, die in einem externen Antwortziel wie einer Tabelle gespeichert sind, aber die Antwort wird aus der Zusammenfassungsansicht des Formulars entfernt. Die Antwort-ID kann mit FormResponse.getId()
abgerufen werden.
Parameter
Name | Typ | Beschreibung |
---|---|---|
responseId | String | Die ID der zu löschenden Formularantwort. |
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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 für das Formular.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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 akzeptiert. Wenn kein benutzerdefinierter Text festgelegt wurde, wird ein leerer String abgerufen.
// 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 wird, wenn das Formular keine Antworten akzeptiert, oder ein leerer String, wenn keine benutzerdefinierte Nachricht festgelegt ist.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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);
Rückflug
DestinationType
: Der Typ des Antwortziels des Formulars.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getEditors()
Ruft die Liste der Editoren für dieses Form
ab.
Rückflug
User[]
: ein Array von Nutzern mit Bearbeitungsberechtigung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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
: Das Element mit der angegebenen ID oder null
, wenn das Element im Formular nicht vorhanden ist.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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 aller Elemente im Formular.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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. |
Rückflug
Item[]
: ein Array aller Elemente dieses Typs.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getPublishedUrl()
Ruft die URL ab, die zum Antworten auf das Formular 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 für das Formular
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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 von FormResponse.getId()
abgerufen werden.
Parameter
Name | Typ | Beschreibung |
---|---|---|
responseId | String | Die ID für die Formularantwort. |
Rückflug
FormResponse
: Die Formularantwort.
Löst aus
Error
: wenn die Antwort nicht vorhanden ist
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getResponses()
Ruft ein Array aller Antworten des Formulars ab
Rückflug
FormResponse[]
: ein Array aller Formularantworten.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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 | 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
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getShuffleQuestions()
Legt fest, ob die Fragen auf jeder Seite des Formulars zufällig angeordnet sind.
Rückflug
Boolean
: true
, wenn die Reihenfolge der Fragen auf jeder Seite des Formulars zufällig angeordnet ist; falls nicht, false
.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getSummaryUrl()
Ruft die URL ab, mit der eine Zusammenfassung der Formularantworten angesehen werden kann. Wenn setPublishingSummary(enabled)
nicht auf true
gesetzt 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 zum Anzeigen einer Zusammenfassung der Antworten.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
hasLimitOneResponsePerUser()
Legt fest, ob das Formular nur eine Antwort pro Teilnehmer zulässt. Wenn der Wert auf true
gesetzt ist, können über das Skript keine Formularantworten gesendet werden.
Rückflug
Boolean
: true
, wenn das Formular nur eine Antwort pro Teilnehmer zulässt. false
, wenn nicht.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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 angezeigt wird. Ist dies nicht der Fall, false
.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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 der 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 das Formular den Link „Weitere Antwort senden“ anzeigt. Andernfalls false
.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
isAcceptingResponses()
Legt fest, ob das Formular derzeit Antworten akzeptiert.
// 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 das Formular Antworten akzeptiert. Andernfalls false
.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
isPublishingSummary()
Legt fest, ob im Formular ein Link zum Ansehen einer Zusammenfassung der Antworten angezeigt wird, nachdem der 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 das Formular den Link „Vorherige Antworten ansehen“ anzeigt. Andernfalls false
.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
isQuiz()
Legt fest, 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());
Rückflug
Boolean
: true
, wenn das Formular Antworten akzeptiert. Andernfalls false
.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
moveItem(from, to)
Verschiebt ein Element an einem bestimmten Index zwischen allen Elementen im Formular in einen anderen Index. Löst eine Skriptausnahme 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 verschobene Element.
Löst aus
Error
: Wenn ein Index außerhalb des zulässigen Bereichs liegt.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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 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 |
toIndex | Integer | Der neue Index für das Element unter allen Elementen im Formular. |
Rückflug
Item
: Das verschobene Element.
Löst aus
Error
: Wenn der Index außerhalb des zulässigen Bereichs liegt.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
removeDestination()
Hier können Sie die Verknüpfung des Formulars mit dem aktuellen Antwortziel aufheben. Die nicht verknüpfte, frühere Zielumgebung enthält weiterhin eine Kopie aller vorherigen Antworten. Alle Formulare, auch solche, für die kein Ziel explizit festgelegt wurde, speichern eine Kopie der Antworten im Antwortspeicher des Formulars. 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
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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 Form
. Diese Methode hindert Nutzer nicht daran, auf Form
zuzugreifen, wenn sie zu einer Gruppe von Nutzern mit allgemeinem Zugriff gehören, z. B. wenn die 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 dadurch aus der Liste der Betrachter entfernt.
Parameter
Name | Typ | Beschreibung |
---|---|---|
emailAddress | String | Die E-Mail-Adresse des Nutzers, der entfernt werden soll. |
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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 Form
. Diese Methode hindert Nutzer nicht daran, auf Form
zuzugreifen, wenn sie zu einer Gruppe von Nutzern mit allgemeinem Zugriff gehören, z. B. wenn die 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 dadurch aus der Liste der Betrachter entfernt.
Parameter
Name | Typ | Beschreibung |
---|---|---|
user | User | Darstellung des zu entfernenden Nutzers |
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
requiresLogin()
Legt fest, ob sich die Teilnehmer am Formular in einem Konto in derselben Domain oder 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);
Rückflug
Boolean
: true
, wenn Nutzer sich im Formular anmelden müssen; andernfalls nicht false
.
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. Andernfalls false . |
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setAllowResponseEdits(enabled)
Legt fest, ob im Formular ein Link angezeigt wird, um eine Antwort nach dem Senden zu bearbeiten. Die Standardeinstellung für neue Formulare ist false
.
Unabhängig von dieser Einstellung ermöglicht die Methode FormResponse.getEditResponseUrl()
einem Skriptautor, der die Berechtigung zum Bearbeiten des Formulars hat, eine URL zu 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 das Formular den Link „Antwort bearbeiten“ enthalten soll; wenn nicht, false . |
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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 erhoben 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 dies nicht der Fall ist. |
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setConfirmationMessage(message)
Legt die Bestätigungsnachricht für das Formular 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. |
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setCustomClosedFormMessage(message)
Die Nachricht wird angezeigt, wenn das Formular keine Antworten akzeptiert. Wenn keine Nachricht festgelegt ist, wird für das 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 Nachricht, die angezeigt wird, wenn das Formular keine Antworten akzeptiert. |
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setDestination(type, id)
Legt das Ziel fest, an dem Formularantworten gespeichert werden sollen. Alle Formulare, auch solche, für die kein Ziel festgelegt ist, speichern 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. |
Rückflug
Form
: Der Form
für eine Verkettung.
Löst aus
Error
: Wenn die angegebene Ziel-ID ungültig ist
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setIsQuiz(enabled)
Hier legen Sie fest, ob es sich bei dem Formular um ein Quiz handelt. Der Standardwert für neue Formulare ist false
.
Benotete Fragen sind nur in Quizzen zulässig. Wenn Sie diese Option auf false
setzen, werden alle Benotungsoptionen aus allen Fragen entfernt.
Quizeinstellungen sind nur in der neuen Benutzeroberfläche von Google Formulare verfügbar. Wenn Sie ein Formular erstellen, wird es für das Formular aktiviert.
// 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; andernfalls false . |
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setLimitOneResponsePerUser(enabled)
Legt fest, ob das Formular nur eine Antwort pro Teilnehmer zulässt. Die Standardeinstellung für neue Formulare ist false
. Wenn der Wert auf true
gesetzt ist, können über das Skript keine Formularantworten gesendet werden.
Parameter
Name | Typ | Beschreibung |
---|---|---|
enabled | Boolean | true , wenn das Formular nur eine Antwort pro Teilnehmer zulassen darf; andernfalls false . |
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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 angezeigt wird, andernfalls false . |
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setPublishingSummary(enabled)
Legt fest, ob im Formular ein Link zum Ansehen der Zusammenfassung der Antworten angezeigt wird, nachdem der Teilnehmer das Formular gesendet hat. Der Standardwert für neue Formulare ist false
.
Parameter
Name | Typ | Beschreibung |
---|---|---|
enabled | Boolean | true , wenn das Formular den Link „Vorherige Antworten ansehen“ anzeigen soll. Andernfalls false . |
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setRequireLogin(requireLogin)
Gibt an, ob sich die Teilnehmer des Formulars in einem Konto in derselben Domain oder Subdomain anmelden müssen, bevor sie antworten können. Der Standardwert für neue Formulare ist false
, sofern kein Domainadministrator den Standard ändert.
Diese Funktion ist nur für Formulare verfügbar, die von Google Workspace-Nutzern erstellt wurden. Nutzer anderer Google-Konten müssen sich nicht anmelden müssen.
// 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 sich Nutzer im Formular anmelden müssen, andernfalls false |
Rückflug
Form
: Die aktuelle Form (für die Verkettung).
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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 der Teilnehmer das Formular ausgefüllt hat. Der Standardwert für neue Formulare ist true
.
Parameter
Name | Typ | Beschreibung |
---|---|---|
enabled | Boolean | true , wenn das Formular den Link „Weitere Antwort senden“ enthalten soll; wenn nicht, false . |
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setShuffleQuestions(shuffle)
Legt fest, ob die Reihenfolge der Fragen auf den einzelnen Seiten des Formulars zufällig angeordnet ist.
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. |
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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 URL, die gekürzt werden soll. |
Rückflug
String
: eine URL im Format http://goo.gl/forms/1234
.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
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 Aufrufen von submitGrades()
die Bedingung onFormSubmit
ausgelöst und eine Endlosschleife ausgelöst. Fügen Sie Code hinzu, der überprüft, ob es bereits Noten gibt, bevor Sie submitGrades()
aufrufen. So lässt sich eine Endlosschleife vermeiden.
Parameter
Name | Typ | Beschreibung |
---|---|---|
responses | FormResponse[] | Ein Array aus allen Antworten des Formulars. |
Rückflug
Form
: Der Form
für eine Verkettung.
Autorisierung
Skripts, die diese Methode verwenden, müssen mit einem oder mehreren der folgenden Bereiche autorisiert werden:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms