Class Form

Form

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

MethodeRückgabetypKurzbeschreibung
addCheckboxGridItem()CheckboxGridItemFü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()CheckboxItemFügt ein neues Frageelement an, mit dem der Teilnehmer ein oder mehrere Kästchen auswählen kann, sowie ein optionales Feld „Sonstiges“.
addDateItem()DateItemFügt ein neues Frageelement an, mit dem der Teilnehmer ein Datum angeben kann.
addDateTimeItem()DateTimeItemFügt ein neues Frageelement an, mit dem der Teilnehmer ein Datum und eine Uhrzeit angeben kann.
addDurationItem()DurationItemFügt ein neues Frageelement an, mit dem der Teilnehmer eine Dauer angeben kann.
addEditor(emailAddress)FormDer entsprechende Nutzer wird der Liste der Mitbearbeiter für Form hinzugefügt.
addEditor(user)FormDer entsprechende Nutzer wird der Liste der Mitbearbeiter für Form hinzugefügt.
addEditors(emailAddresses)FormFügt das angegebene Array von Nutzern der Liste der Mitbearbeiter für Form hinzu.
addGridItem()GridItemEs 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()ImageItemFügt ein neues Layoutelement an, das ein Bild darstellt.
addListItem()ListItemEs wird ein neues Frageelement angehängt, aus dem der Teilnehmer eine Antwort aus einer Drop-down-Liste auswählen kann.
addMultipleChoiceItem()MultipleChoiceItemFü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()PageBreakItemFügt ein neues Layoutelement hinzu, das den Beginn einer Seite markiert.
addParagraphTextItem()ParagraphTextItemFügt ein neues Frageelement hinzu, mit dem der Teilnehmer einen Textblock eingeben kann.
addScaleItem()ScaleItemEs wird ein neues Frageelement angehängt, aus dem der Teilnehmer eine Option aus einer nummerierten Abfolge von Optionsfeldern auswählen kann.
addSectionHeaderItem()SectionHeaderItemFügt ein neues Layoutelement an, das den Beginn eines Abschnitts angibt.
addTextItem()TextItemFügt ein neues Frageelement an, das es dem Teilnehmer ermöglicht, eine einzelne Textzeile einzugeben.
addTimeItem()TimeItemFügt ein neues Frageelement an, mit dem der Teilnehmer eine Tageszeit angeben kann.
addVideoItem()VideoItemFügt ein neues Layoutelement an, in dem ein Video angezeigt wird.
canEditResponse()BooleanLegt fest, ob im Formular ein Link zum Bearbeiten einer Antwort angezeigt wird, nachdem er gesendet wurde.
collectsEmail()BooleanLegt fest, ob im Formular die E-Mail-Adressen der Befragten erhoben werden.
createResponse()FormResponseErstellt eine neue Antwort auf das Formular.
deleteAllResponses()FormLöscht alle gesendeten Antworten aus dem Antwortspeicher des Formulars.
deleteItem(index)voidLöscht das Element bei einem bestimmten Index unter allen Elementen im Formular.
deleteItem(item)voidLöscht das angegebene Element
deleteResponse(responseId)FormLöscht eine einzelne Antwort aus dem Antwortspeicher des Formulars.
getConfirmationMessage()StringRuft die Bestätigungsnachricht des Formulars ab.
getCustomClosedFormMessage()StringRuft 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()StringRuft die Beschreibung des Formulars ab
getDestinationId()StringRuft die ID des Antwortziels des Formulars ab
getDestinationType()DestinationTypeRuft den Typ des Antwortziels des Formulars ab.
getEditUrl()StringRuft 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()StringRuft die ID des Formulars ab
getItemById(id)ItemRuft 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()StringRuft die URL ab, die zum Antworten auf das Formular verwendet werden kann.
getResponse(responseId)FormResponseRuft 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()BooleanLegt fest, ob die Fragen auf jeder Seite des Formulars zufällig angeordnet sind.
getSummaryUrl()StringRuft die URL ab, mit der eine Zusammenfassung der Formularantworten angesehen werden kann.
getTitle()StringRuft den Titel des Formulars ab
hasLimitOneResponsePerUser()BooleanLegt fest, ob das Formular nur eine Antwort pro Teilnehmer zulässt.
hasProgressBar()BooleanLegt fest, ob im Formular eine Fortschrittsanzeige zu sehen ist.
hasRespondAgainLink()BooleanLegt fest, ob im Formular ein Link zum Senden einer weiteren Antwort angezeigt wird, nachdem der Teilnehmer das Formular ausgefüllt hat.
isAcceptingResponses()BooleanLegt fest, ob das Formular derzeit Antworten akzeptiert.
isPublishingSummary()BooleanLegt fest, ob im Formular ein Link zum Ansehen einer Zusammenfassung der Antworten angezeigt wird, nachdem der Teilnehmer das Formular ausgefüllt hat.
isQuiz()BooleanLegt fest, ob das Formular ein Quiz ist.
moveItem(from, to)ItemVerschiebt ein Element an einem bestimmten Index zwischen allen Elementen im Formular in einen anderen Index.
moveItem(item, toIndex)ItemVerschiebt ein bestimmtes Element in einen bestimmten Index unter allen Elementen im Formular.
removeDestination()FormHier können Sie die Verknüpfung des Formulars mit dem aktuellen Antwortziel aufheben.
removeEditor(emailAddress)FormEntfernt den angegebenen Nutzer aus der Liste der Mitbearbeiter für Form.
removeEditor(user)FormEntfernt den angegebenen Nutzer aus der Liste der Mitbearbeiter für Form.
requiresLogin()BooleanLegt fest, ob sich die Teilnehmer am Formular in einem Konto in derselben Domain oder Subdomain anmelden müssen, bevor sie antworten.
setAcceptingResponses(enabled)FormLegt fest, ob das Formular derzeit Antworten akzeptiert.
setAllowResponseEdits(enabled)FormLegt fest, ob im Formular ein Link angezeigt wird, um eine Antwort nach dem Senden zu bearbeiten.
setCollectEmail(collect)FormLegt fest, ob im Formular die E-Mail-Adressen der Befragten erhoben werden.
setConfirmationMessage(message)FormLegt die Bestätigungsnachricht für das Formular fest.
setCustomClosedFormMessage(message)FormDie Nachricht wird angezeigt, wenn das Formular keine Antworten akzeptiert.
setDescription(description)FormLegt die Beschreibung des Formulars fest.
setDestination(type, id)FormLegt das Ziel fest, an dem Formularantworten gespeichert werden sollen.
setIsQuiz(enabled)FormHier legen Sie fest, ob es sich bei dem Formular um ein Quiz handelt.
setLimitOneResponsePerUser(enabled)FormLegt fest, ob das Formular nur eine Antwort pro Teilnehmer zulässt.
setProgressBar(enabled)FormLegt fest, ob das Formular eine Fortschrittsanzeige hat.
setPublishingSummary(enabled)FormLegt fest, ob im Formular ein Link zum Ansehen der Zusammenfassung der Antworten angezeigt wird, nachdem der Teilnehmer das Formular gesendet hat.
setRequireLogin(requireLogin)FormGibt 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)FormLegt fest, ob im Formular ein Link zum Senden einer weiteren Antwort angezeigt wird, nachdem der Teilnehmer das Formular ausgefüllt hat.
setShuffleQuestions(shuffle)FormLegt fest, ob die Reihenfolge der Fragen auf den einzelnen Seiten des Formulars zufällig angeordnet ist.
setTitle(title)FormLegt den Titel des Formulars fest.
shortenFormUrl(url)StringWandelt 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

NameTypBeschreibung
emailAddressStringDie 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

NameTypBeschreibung
userUserEine 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

NameTypBeschreibung
emailAddressesString[]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

NameTypBeschreibung
indexIntegerDer 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

NameTypBeschreibung
itemItemDas 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

NameTypBeschreibung
responseIdStringDie 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

NameTypBeschreibung
idIntegerDie 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

NameTypBeschreibung
itemTypeItemTypeDer 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

NameTypBeschreibung
responseIdStringDie 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

NameTypBeschreibung
timestampDateDas 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

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

NameTypBeschreibung
fromIntegerDer aktuelle Index des Elements unter allen Elementen im Formular.
toIntegerDer 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

NameTypBeschreibung
itemItemDas zu verschiebende Element
toIndexIntegerDer 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

NameTypBeschreibung
emailAddressStringDie 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

NameTypBeschreibung
userUserDarstellung 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

NameTypBeschreibung
enabledBooleantrue, 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

NameTypBeschreibung
enabledBooleantrue, 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

NameTypBeschreibung
collectBooleantrue, 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

NameTypBeschreibung
messageStringDie 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

NameTypBeschreibung
messageStringDie 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

NameTypBeschreibung
descriptionStringDie 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

NameTypBeschreibung
typeDestinationTypeDer Typ des Antwortziels des Formulars.
idStringDie 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

NameTypBeschreibung
enabledBooleantrue, 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

NameTypBeschreibung
enabledBooleantrue, 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

NameTypBeschreibung
enabledBooleantrue, 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

NameTypBeschreibung
enabledBooleantrue, 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

NameTypBeschreibung
requireLoginBooleantrue, 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

NameTypBeschreibung
enabledBooleantrue, 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

NameTypBeschreibung
shuffleBooleantrue, 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

NameTypBeschreibung
titleStringDer 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

NameTypBeschreibung
urlStringDie 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

NameTypBeschreibung
responsesFormResponse[]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