Form

A form that contains overall properties and items. Properties include title, settings, and where
responses are stored. Items include question items like checkboxes or radio items, while layout
items refer to things like page breaks. Forms can be accessed or created from `https://developers.google.com/apps-script/reference/forms/form-app`.

```javascript
// Open a form by ID and create a new spreadsheet.
const form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
const ss = SpreadsheetApp.create('Spreadsheet Name');

// Update form properties via chaining.
form.setTitle('Form Name')
    .setDescription('Description of form')
    .setConfirmationMessage('Thanks for responding!')
    .setAllowResponseEdits(true)
    .setAcceptingResponses(false);

// Update the form's response destination.
form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());
```

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/forms/form#addCheckboxGridItem()` | `https://developers.google.com/apps-script/reference/forms/checkbox-grid-item` | Appends a new question item, presented as a grid of columns and rows, that allows the respondent to select multiple choices per row from a sequence of checkboxes. |
| `https://developers.google.com/apps-script/reference/forms/form#addCheckboxItem()` | `https://developers.google.com/apps-script/reference/forms/checkbox-item` | Appends a new question item that allows the respondent to select one or more checkboxes, as well as an optional "other" field. |
| `https://developers.google.com/apps-script/reference/forms/form#addDateItem()` | `https://developers.google.com/apps-script/reference/forms/date-item` | Appends a new question item that allows the respondent to indicate a date. |
| `https://developers.google.com/apps-script/reference/forms/form#addDateTimeItem()` | `https://developers.google.com/apps-script/reference/forms/date-time-item` | Appends a new question item that allows the respondent to indicate a date and time. |
| `https://developers.google.com/apps-script/reference/forms/form#addDurationItem()` | `https://developers.google.com/apps-script/reference/forms/duration-item` | Appends a new question item that allows the respondent to indicate a length of time. |
| `https://developers.google.com/apps-script/reference/forms/form#addEditor(String)` | `https://developers.google.com/apps-script/reference/forms/form#` | Adds the given user to the list of editors for the `https://developers.google.com/apps-script/reference/forms/form#`. |
| `https://developers.google.com/apps-script/reference/forms/form#addEditor(User)` | `https://developers.google.com/apps-script/reference/forms/form#` | Adds the given user to the list of editors for the `https://developers.google.com/apps-script/reference/forms/form#`. |
| `https://developers.google.com/apps-script/reference/forms/form#addEditors(String)` | `https://developers.google.com/apps-script/reference/forms/form#` | Adds the given array of users to the list of editors for the `https://developers.google.com/apps-script/reference/forms/form#`. |
| `https://developers.google.com/apps-script/reference/forms/form#addGridItem()` | `https://developers.google.com/apps-script/reference/forms/grid-item` | Appends a new question item, presented as a grid of columns and rows, that allows the respondent to select one choice per row from a sequence of radio buttons. |
| `https://developers.google.com/apps-script/reference/forms/form#addImageItem()` | `https://developers.google.com/apps-script/reference/forms/image-item` | Appends a new layout item that displays an image. |
| `https://developers.google.com/apps-script/reference/forms/form#addListItem()` | `https://developers.google.com/apps-script/reference/forms/list-item` | Appends a new question item that allows the respondent to select one choice from a dropdown list. |
| `https://developers.google.com/apps-script/reference/forms/form#addMultipleChoiceItem()` | `https://developers.google.com/apps-script/reference/forms/multiple-choice-item` | Adds a new question item that allows the respondent to select one choice from a list of radio buttons or an optional "other" field. |
| `https://developers.google.com/apps-script/reference/forms/form#addPageBreakItem()` | `https://developers.google.com/apps-script/reference/forms/page-break-item` | Adds a new layout item that marks the start of a page. |
| `https://developers.google.com/apps-script/reference/forms/form#addParagraphTextItem()` | `https://developers.google.com/apps-script/reference/forms/paragraph-text-item` | Adds a new question item that allows the respondent to enter a block of text. |
| `https://developers.google.com/apps-script/reference/forms/form#addPublishedReader(String)` | `https://developers.google.com/apps-script/reference/forms/form#` | Adds the given user to the list of responders for the `https://developers.google.com/apps-script/reference/forms/form#`. |
| `https://developers.google.com/apps-script/reference/forms/form#addPublishedReader(User)` | `https://developers.google.com/apps-script/reference/forms/form#` | Adds the given user to the list of responders for the `https://developers.google.com/apps-script/reference/forms/form#`. |
| `https://developers.google.com/apps-script/reference/forms/form#addPublishedReaders(String)` | `https://developers.google.com/apps-script/reference/forms/form#` | Adds the given array of users to the list of responders for the `https://developers.google.com/apps-script/reference/forms/form#`. |
| `https://developers.google.com/apps-script/reference/forms/form#addRatingItem()` | `https://developers.google.com/apps-script/reference/forms/rating-item` | Appends a new question item that allows the respondent to give a rating. |
| `https://developers.google.com/apps-script/reference/forms/form#addScaleItem()` | `https://developers.google.com/apps-script/reference/forms/scale-item` | Appends a new question item that allows the respondent to choose one option from a numbered sequence of radio buttons. |
| `https://developers.google.com/apps-script/reference/forms/form#addSectionHeaderItem()` | `https://developers.google.com/apps-script/reference/forms/section-header-item` | Appends a new layout item that visually indicates the start of a section. |
| `https://developers.google.com/apps-script/reference/forms/form#addTextItem()` | `https://developers.google.com/apps-script/reference/forms/text-item` | Appends a new question item that allows the respondent to enter a single line of text. |
| `https://developers.google.com/apps-script/reference/forms/form#addTimeItem()` | `https://developers.google.com/apps-script/reference/forms/time-item` | Appends a new question item that allows the respondent to indicate a time of day. |
| `https://developers.google.com/apps-script/reference/forms/form#addVideoItem()` | `https://developers.google.com/apps-script/reference/forms/video-item` | Appends a new layout item that displays a video. |
| `https://developers.google.com/apps-script/reference/forms/form#canEditResponse()` | `Boolean` | Determines whether the form displays a link to edit a response after submitting it. |
| `https://developers.google.com/apps-script/reference/forms/form#collectsEmail()` | `Boolean` | Determines whether the form collects respondents' email addresses. |
| `https://developers.google.com/apps-script/reference/forms/form#createResponse()` | `https://developers.google.com/apps-script/reference/forms/form-response` | Creates a new response to the form. |
| `https://developers.google.com/apps-script/reference/forms/form#deleteAllResponses()` | `https://developers.google.com/apps-script/reference/forms/form#` | Deletes all submitted responses from the form's response store. |
| `https://developers.google.com/apps-script/reference/forms/form#deleteItem(Integer)` | `void` | Deletes the item at a given index among all the items in the form. |
| `https://developers.google.com/apps-script/reference/forms/form#deleteItem(Item)` | `void` | Deletes the given item. |
| `https://developers.google.com/apps-script/reference/forms/form#deleteResponse(String)` | `https://developers.google.com/apps-script/reference/forms/form#` | Deletes a single response from the form's response store. |
| `https://developers.google.com/apps-script/reference/forms/form#getConfirmationMessage()` | `String` | Gets the form's confirmation message. |
| `https://developers.google.com/apps-script/reference/forms/form#getCustomClosedFormMessage()` | `String` | Gets the custom message that is displayed if the form is not accepting responses, or an empty string if no custom message is set. |
| `https://developers.google.com/apps-script/reference/forms/form#getDescription()` | `String` | Gets the form's description. |
| `https://developers.google.com/apps-script/reference/forms/form#getDestinationId()` | `String` | Gets the ID of the form's response destination. |
| `https://developers.google.com/apps-script/reference/forms/form#getDestinationType()` | `https://developers.google.com/apps-script/reference/forms/destination-type` | Gets the type of the form's response destination. |
| `https://developers.google.com/apps-script/reference/forms/form#getEditUrl()` | `String` | Gets the URL that can be used to access the form's edit mode. |
| `https://developers.google.com/apps-script/reference/forms/form#getEditors()` | `https://developers.google.com/apps-script/reference/base/user.html` | Gets the list of editors for this `https://developers.google.com/apps-script/reference/forms/form#`. |
| `https://developers.google.com/apps-script/reference/forms/form#getId()` | `String` | Gets the ID of the form. |
| `https://developers.google.com/apps-script/reference/forms/form#getItemById(Integer)` | `https://developers.google.com/apps-script/reference/forms/item|null` | Gets the item with a given ID. |
| `https://developers.google.com/apps-script/reference/forms/form#getItems()` | `https://developers.google.com/apps-script/reference/forms/item` | Gets an array of all items in the form. |
| `https://developers.google.com/apps-script/reference/forms/form#getItems(ItemType)` | `https://developers.google.com/apps-script/reference/forms/item` | Gets an array of all items of a given type. |
| `https://developers.google.com/apps-script/reference/forms/form#getPublishedReaders()` | `https://developers.google.com/apps-script/reference/base/user.html` | Gets the list of responders for this `https://developers.google.com/apps-script/reference/forms/form#`. |
| `https://developers.google.com/apps-script/reference/forms/form#getPublishedUrl()` | `String` | Gets the URL that can be used to respond to the form. |
| `https://developers.google.com/apps-script/reference/forms/form#getResponse(String)` | `https://developers.google.com/apps-script/reference/forms/form-response` | Gets a single form response based on its response ID. |
| `https://developers.google.com/apps-script/reference/forms/form#getResponses()` | `https://developers.google.com/apps-script/reference/forms/form-response` | Gets an array of all of the form's responses. |
| `https://developers.google.com/apps-script/reference/forms/form#getResponses(Date)` | `https://developers.google.com/apps-script/reference/forms/form-response` | Gets an array of all of the form's responses after a given date and time. |
| `https://developers.google.com/apps-script/reference/forms/form#getShuffleQuestions()` | `Boolean` | Determines whether the order of the questions on each page of the form is randomized. |
| `https://developers.google.com/apps-script/reference/forms/form#getSummaryUrl()` | `String` | Gets the URL that can be used to view a summary of the form's responses. |
| `https://developers.google.com/apps-script/reference/forms/form#getTitle()` | `String` | Gets the form's title. |
| `https://developers.google.com/apps-script/reference/forms/form#hasLimitOneResponsePerUser()` | `Boolean` | Determines whether the form allows only one response per respondent. |
| `https://developers.google.com/apps-script/reference/forms/form#hasProgressBar()` | `Boolean` | Determines whether the form displays a progress bar. |
| `https://developers.google.com/apps-script/reference/forms/form#hasRespondAgainLink()` | `Boolean` | Determines whether the form displays a link to submit another response after a respondent completes the form. |
| `https://developers.google.com/apps-script/reference/forms/form#isAcceptingResponses()` | `Boolean` | Determines whether the form is currently accepting responses. |
| `https://developers.google.com/apps-script/reference/forms/form#isPublished()` | `Boolean` | Determines whether the form is published. |
| `https://developers.google.com/apps-script/reference/forms/form#isPublishingSummary()` | `Boolean` | Determines whether the form displays a link to view a summary of responses after a respondent completes the form. |
| `https://developers.google.com/apps-script/reference/forms/form#isQuiz()` | `Boolean` | Determines whether the form is a quiz. |
| `https://developers.google.com/apps-script/reference/forms/form#moveItem(Integer,Integer)` | `https://developers.google.com/apps-script/reference/forms/item` | Moves an item at a given index among all the items in the form to another given index. |
| `https://developers.google.com/apps-script/reference/forms/form#moveItem(Item,Integer)` | `https://developers.google.com/apps-script/reference/forms/item` | Moves a given item to a given index among all the items in the form. |
| `https://developers.google.com/apps-script/reference/forms/form#removeDestination()` | `https://developers.google.com/apps-script/reference/forms/form#` | Unlinks the form from its current response destination. |
| `https://developers.google.com/apps-script/reference/forms/form#removeEditor(String)` | `https://developers.google.com/apps-script/reference/forms/form#` | Removes the given user from the list of editors for the `https://developers.google.com/apps-script/reference/forms/form#`. |
| `https://developers.google.com/apps-script/reference/forms/form#removeEditor(User)` | `https://developers.google.com/apps-script/reference/forms/form#` | Removes the given user from the list of editors for the `https://developers.google.com/apps-script/reference/forms/form#`. |
| `https://developers.google.com/apps-script/reference/forms/form#removePublishedReader(String)` | `https://developers.google.com/apps-script/reference/forms/form#` | Removes the given user from the list of responders for the `https://developers.google.com/apps-script/reference/forms/form#`. |
| `https://developers.google.com/apps-script/reference/forms/form#removePublishedReader(User)` | `https://developers.google.com/apps-script/reference/forms/form#` | Removes the given user from the list of responders for the `https://developers.google.com/apps-script/reference/forms/form#`. |
| `https://developers.google.com/apps-script/reference/forms/form#setAcceptingResponses(Boolean)` | `https://developers.google.com/apps-script/reference/forms/form#` | Sets whether the form is currently accepting responses. |
| `https://developers.google.com/apps-script/reference/forms/form#setAllowResponseEdits(Boolean)` | `https://developers.google.com/apps-script/reference/forms/form#` | Sets whether the form displays a link to edit a response after submitting it. |
| `https://developers.google.com/apps-script/reference/forms/form#setCollectEmail(Boolean)` | `https://developers.google.com/apps-script/reference/forms/form#` | Sets whether the form collects respondents' email addresses. |
| `https://developers.google.com/apps-script/reference/forms/form#setConfirmationMessage(String)` | `https://developers.google.com/apps-script/reference/forms/form#` | Sets the form's confirmation message. |
| `https://developers.google.com/apps-script/reference/forms/form#setCustomClosedFormMessage(String)` | `https://developers.google.com/apps-script/reference/forms/form#` | Sets the message to display if the form is not accepting responses. |
| `https://developers.google.com/apps-script/reference/forms/form#setDescription(String)` | `https://developers.google.com/apps-script/reference/forms/form#` | Sets the form's description. |
| `https://developers.google.com/apps-script/reference/forms/form#setDestination(DestinationType,String)` | `https://developers.google.com/apps-script/reference/forms/form#` | Sets the destination where form responses are saved. |
| `https://developers.google.com/apps-script/reference/forms/form#setIsQuiz(Boolean)` | `https://developers.google.com/apps-script/reference/forms/form#` | Sets whether the form is a quiz. |
| `https://developers.google.com/apps-script/reference/forms/form#setLimitOneResponsePerUser(Boolean)` | `https://developers.google.com/apps-script/reference/forms/form#` | Sets whether the form allows only one response per respondent. |
| `https://developers.google.com/apps-script/reference/forms/form#setProgressBar(Boolean)` | `https://developers.google.com/apps-script/reference/forms/form#` | Sets whether the form has a progress bar. |
| `https://developers.google.com/apps-script/reference/forms/form#setPublished(Boolean)` | `https://developers.google.com/apps-script/reference/forms/form#` | Sets whether the form is published. |
| `https://developers.google.com/apps-script/reference/forms/form#setPublishingSummary(Boolean)` | `https://developers.google.com/apps-script/reference/forms/form#` | Sets whether the form displays a link to view a summary of responses after a respondent submits the form. |
| `https://developers.google.com/apps-script/reference/forms/form#setShowLinkToRespondAgain(Boolean)` | `https://developers.google.com/apps-script/reference/forms/form#` | Sets whether the form displays a link to submit another response after a respondent completes the form. |
| `https://developers.google.com/apps-script/reference/forms/form#setShuffleQuestions(Boolean)` | `https://developers.google.com/apps-script/reference/forms/form#` | Sets whether the order of the questions on each page of the form is randomized. |
| `https://developers.google.com/apps-script/reference/forms/form#setTitle(String)` | `https://developers.google.com/apps-script/reference/forms/form#` | Sets the form's title. |
| `https://developers.google.com/apps-script/reference/forms/form#shortenFormUrl(String)` | `String` | Converts a long URL for a form to a short URL. |
| `https://developers.google.com/apps-script/reference/forms/form#submitGrades(FormResponse)` | `https://developers.google.com/apps-script/reference/forms/form#` | Submits grades for the given FormResponses. |
| `https://developers.google.com/apps-script/reference/forms/form#supportsAdvancedResponderPermissions()` | `Boolean` | Determines whether the form supports publishing. |

### Deprecated methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/forms/form#requiresLogin()` | `Boolean` | Determines whether the form requires respondents to log in to an account in the same domain or a subdomain before responding. |
| `https://developers.google.com/apps-script/reference/forms/form#setRequireLogin(Boolean)` | `https://developers.google.com/apps-script/reference/forms/form#` | Sets whether the form requires respondents to log in to an account in the same domain or a subdomain before responding. |

## Detailed documentation

### `addCheckboxGridItem()`

Appends a new question item, presented as a grid of columns and rows, that allows the
respondent to select multiple choices per row from a sequence of checkboxes.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Adds a checkbox grid item.
const item = form.addCheckboxGridItem();

item.setTitle('Where did you celebrate New Year\'s?');

// Sets the grid's rows and columns.
item.setRows(['New York', 'San Francisco', 'London']).setColumns([
  '2014', '2015', '2016', '2017'
]);
```

#### Return


`https://developers.google.com/apps-script/reference/forms/checkbox-grid-item` --- The newly created item.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addCheckboxItem()`

Appends a new question item that allows the respondent to select one or more checkboxes, as
well as an optional "other" field.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Adds a checkbox item.
const item = form.addCheckboxItem();

// Sets the title of the checkbox item to 'Do you prefer cats or dogs?'
item.setTitle('Do you prefer cats or dogs?');

// Sets the choices.
item.setChoiceValues(['Cats', 'Dogs']);
```

#### Return


`https://developers.google.com/apps-script/reference/forms/checkbox-item` --- The newly created item.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addDateItem()`

Appends a new question item that allows the respondent to indicate a date.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Adds a date item.
const item = form.addDateItem();

// Sets the title to 'When were you born?'
item.setTitle('When were you born?');

// Sets the description for the date item.
item.setHelpText('Some helper text.');
```

#### Return


`https://developers.google.com/apps-script/reference/forms/date-item` --- The newly created item.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addDateTimeItem()`

Appends a new question item that allows the respondent to indicate a date and time.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Adds a question with date and time inputs.
const item = form.addDateTimeItem();

// Sets the title to 'When were you born?'
item.setTitle('When were you born?');

// Sets the question as required.
item.setRequired(true);
```

#### Return


`https://developers.google.com/apps-script/reference/forms/date-time-item` --- The newly created item.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addDurationItem()`

Appends a new question item that allows the respondent to indicate a length of time.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Adds a question with a duration input.
const item = form.addDurationItem();

// Sets the title to 'How long can you hold your breath?'
item.setTitle('How long can you hold your breath?');

// Sets the question as required.
item.setRequired(true);
```

#### Return


`https://developers.google.com/apps-script/reference/forms/duration-item` --- The newly created item.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addEditor(emailAddress)`

Adds the given user to the list of editors for the `https://developers.google.com/apps-script/reference/forms/form#`. If the user was already on the
list of viewers or responders, this method promotes the user out of the list.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds editor to the form.
// TODO(developer): replace the emailAddress.
form.addEditor('editor@uni.edu');
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `emailAddress` | `String` | The email address of the user to add. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addEditor(user)`

Adds the given user to the list of editors for the `https://developers.google.com/apps-script/reference/forms/form#`. If the user was already on the
list of viewers or responders, this method promotes the user out of the list.

```javascript
// Opens the Forms file by its URL.
// TODO(developer): Replace the URL with your own.
const oldForm = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the editors from the old form.
const users = oldForm.getEditors();

// Creates a new form.
const newForm = FormApp.create('New form');

// Adds the editors to a new form.
users.forEach(user => newForm.addEditor(user));
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `user` | `https://developers.google.com/apps-script/reference/base/user.html` | A representation of the user to add. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addEditors(emailAddresses)`

Adds the given array of users to the list of editors for the `https://developers.google.com/apps-script/reference/forms/form#`. If any of the users
were already on the list of viewers, this method promotes them out of the list of viewers.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds editors to the form.
// TODO(developer): replace the emailAddress.
form.addPublishedReaders(['editor1@uni.edu', 'editor2@uni.edu']);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `emailAddresses` | `String[]` | An array of email addresses of the users to add. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addGridItem()`

Appends a new question item, presented as a grid of columns and rows, that allows the
respondent to select one choice per row from a sequence of radio buttons.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Adds a multiple choice grid.
const item = form.addGridItem();

// Sets the title to 'Rate your interests.'
item.setTitle('Rate your interests');

// Sets the grid's rows and columns.
item.setRows(['Cars', 'Computers', 'Celebrities']).setColumns([
  'Boring', 'So-so', 'Interesting'
]);
```

#### Return


`https://developers.google.com/apps-script/reference/forms/grid-item` --- The newly created item.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addImageItem()`

Appends a new layout item that displays an image.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Adds an image item.
const item = form.addImageItem();

// Gets the Google icon to use as the image.
const img = UrlFetchApp.fetch(
    'https://fonts.gstatic.com/s/i/productlogos/googleg/v6/web-24dp/logo_googleg_color_1x_web_24dp.png',
);

// Sets the image, title, and description for the item.
item.setTitle('Google icon').setHelpText('Google icon').setImage(img);
```

#### Return


`https://developers.google.com/apps-script/reference/forms/image-item` --- The newly created item.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addListItem()`

Appends a new question item that allows the respondent to select one choice from a dropdown
list.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Adds a dropdown list to the form.
const item = form.addListItem();

// Sets the title to 'Do you prefer cats or dogs?'
item.setTitle('Do you prefer cats or dogs?');

// Sets the description to 'This is description text...'
item.setHelpText('This is description text...');

// Creates and adds choices to the dropdown list.
item.setChoices([item.createChoice('dog'), item.createChoice('cat')]);
```

#### Return


`https://developers.google.com/apps-script/reference/forms/list-item` --- The newly created item.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addMultipleChoiceItem()`

Adds a new question item that allows the respondent to select one choice from a list of radio
buttons or an optional "other" field.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Adds a multiple choice item to the form.
const item = form.addMultipleChoiceItem();

// Sets the title.
item.setTitle('What is your favorite ice cream flavor?');

// Creates some choice items.
const vanilla = item.createChoice('vanilla');
const chocolate = item.createChoice('chocolate');
const strawberry = item.createChoice('strawberry');

// Sets the choices.
item.setChoices([vanilla, chocolate, strawberry]);
```

#### Return


`https://developers.google.com/apps-script/reference/forms/multiple-choice-item` --- The newly created item.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addPageBreakItem()`

Adds a new layout item that marks the start of a page.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Adds page break items to create a second and third page for the form.
const pageTwo = form.addPageBreakItem();
const pageThree = form.addPageBreakItem();

// Sets the titles for the pages.
pageTwo.setTitle('Page two');
pageThree.setTitle('Page three');

// Upon completion of the first page, sets the form to navigate to the third
// page.
pageTwo.setGoToPage(pageThree);

// Upon completion of the second page, sets the form to navigate back to the
// first page.
pageThree.setGoToPage(FormApp.PageNavigationType.RESTART);
```

#### Return


`https://developers.google.com/apps-script/reference/forms/page-break-item` --- The newly created item.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addParagraphTextItem()`

Adds a new question item that allows the respondent to enter a block of text.

```javascript
// Opens the form by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Adds the paragraph text item.
const item = form.addParagraphTextItem();

// Sets the title to 'What is your address?'
item.setTitle('What is your address?');
```

#### Return


`https://developers.google.com/apps-script/reference/forms/paragraph-text-item` --- The newly created item.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addPublishedReader(emailAddress)`

Adds the given user to the list of responders for the `https://developers.google.com/apps-script/reference/forms/form#`. If the user was already on
the list of editors or viewers, this method has no effect.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds responder to the form.
// TODO(developer): replace the emailAddress.
form.addPublishedReader('responder@uni.edu');
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `emailAddress` | `String` | The email address of the user to add. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addPublishedReader(user)`

Adds the given user to the list of responders for the `https://developers.google.com/apps-script/reference/forms/form#`. If the user was already on
the list of editors or viewers, this method has no effect.

```javascript
// Opens the Forms file by its URL.
// TODO(developer): Replace the URL with your own.
const oldForm = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the responders from the old form.
const users = oldForm.getPublishedReaders();

// Creates a new form.
const newForm = FormApp.create('New form');

// Adds the responders to a new form.
users.forEach(user => newForm.addPublishedReader(user));
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `user` | `https://developers.google.com/apps-script/reference/base/user.html` | A representation of the user to add. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addPublishedReaders(emailAddresses)`

Adds the given array of users to the list of responders for the `https://developers.google.com/apps-script/reference/forms/form#`. If the user was
already on the list of editors or viewers, this method has no effect.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds responders to the form.
// TODO(developer): replace the emailAddress.
form.addPublishedReaders(['responder1@uni.edu', 'responder2@uni.edu']);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `emailAddresses` | `String[]` | An array of email addresses of the users to add. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addRatingItem()`

Appends a new question item that allows the respondent to give a rating.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Adds the rating item.
const item = form.addRatingItem();
```

#### Return


`https://developers.google.com/apps-script/reference/forms/rating-item` --- The newly created item.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addScaleItem()`

Appends a new question item that allows the respondent to choose one option from a numbered
sequence of radio buttons.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Adds the scale item.
const item = form.addScaleItem();

// Sets the title of the scale item to 'Choose a number.'
item.setTitle('Choose a number');

// Sets the scale to 1-5.
item.setBounds(1, 5);

// Sets the label for the lower and upper bounds.
item.setLabels('Lowest', 'Highest');
```

#### Return


`https://developers.google.com/apps-script/reference/forms/scale-item` --- The newly created item.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addSectionHeaderItem()`

Appends a new layout item that visually indicates the start of a section.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Adds the section heading item.
const item = form.addSectionHeaderItem();

// Sets the title to 'Title of new section.'
item.setTitle('Title of new section');

// Sets the description.
item.setHelpText('Description of new section');
```

#### Return


`https://developers.google.com/apps-script/reference/forms/section-header-item` --- The newly created item.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addTextItem()`

Appends a new question item that allows the respondent to enter a single line of text.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Adds a single-line text item.
const item = form.addTextItem();

// Sets the title to 'What is your name?'
item.setTitle('What is your name?');
```

#### Return


`https://developers.google.com/apps-script/reference/forms/text-item` --- The newly created item.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addTimeItem()`

Appends a new question item that allows the respondent to indicate a time of day.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Adds a question with a time input.
const item = form.addTimeItem();

// Sets the title to 'What time do you usually wake up in the morning?'
item.setTitle('What time do you usually wake up in the morning?');
```

#### Return


`https://developers.google.com/apps-script/reference/forms/time-item` --- The newly created item.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `addVideoItem()`

Appends a new layout item that displays a video.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Adds a video item.
const item = form.addVideoItem();

// Sets the title, description, and video.
item.setTitle('YouTube video')
    .setHelpText('Send content automatically via Google Sheets and Apps Script')
    .setVideoUrl('https://youtu.be/xxgQr-jSu9o');

// Sets the alignment to the center.
item.setAlignment(FormApp.Alignment.CENTER);
```

#### Return


`https://developers.google.com/apps-script/reference/forms/video-item` --- The newly created item.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `canEditResponse()`

Determines whether the form displays a link to edit a response after submitting it.

Regardless of this setting, the method `https://developers.google.com/apps-script/reference/forms/form-response#getEditResponseUrl()` allows a
script author who has edit access to the form to generate a URL that can be used to edit a
response.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Checks if the form displays a link to edit a response after submitting it.
// The default is false. To let people edit their responses, use
// form.setAllowResponseEdits(true).
const edit = form.canEditResponse();

// If the form doesn't let people edit responses, logs false to the console.
console.log(edit);
```

#### Return


`Boolean` --- `true` if the form displays an "Edit your response" link; `false` if it
doesn't.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `collectsEmail()`

Determines whether the form collects respondents' email addresses.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Sets the form to not collect respondents' email addresses.
form.setCollectEmail(false);

// Checks whether the form collects respondents' email addresses and logs it to
// the console.
const bool = form.collectsEmail();

console.log(bool);
```

#### Return


`Boolean` --- `true` if the form collects email addresses; `false` if it doesn't.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `createResponse()`

Creates a new response to the form. To answer a question item, create an `https://developers.google.com/apps-script/reference/forms/item-response`
from the item, then attach it to this form response by calling `https://developers.google.com/apps-script/reference/forms/form-response#withItemResponse(ItemResponse)`. To save the assembled response, call `https://developers.google.com/apps-script/reference/forms/form-response#submit()`.

#### Return


`https://developers.google.com/apps-script/reference/forms/form-response` --- The newly created form response.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `deleteAllResponses()`

Deletes all submitted responses from the form's response store. This method does not delete
copies of responses stored in an external response destination (like a spreadsheet), but does
clear the form's summary view.


> [!WARNING]
> Beware: this method is irreversible.

<br />

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `deleteItem(index)`

Deletes the item at a given index among all the items in the form. Throws a scripting exception
if no item exists at the given index.

```javascript
// 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);
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `index` | `Integer` | The index of the item among all the items in the form. |

#### Throws


[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if no item exists at the given index

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `deleteItem(item)`

Deletes the given item. Throws a scripting exception if the item has already been deleted.

```javascript
// 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);
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `item` | `https://developers.google.com/apps-script/reference/forms/item` | The item to be deleted. |

#### Throws


[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if the item does not exist in the form

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `deleteResponse(responseId)`

Deletes a single response from the form's response store. This method does not delete copies of
responses stored in an external response destination (like a spreadsheet), but does remove the
response from the form's summary view. The response ID can be retrieved with `https://developers.google.com/apps-script/reference/forms/form-response#getId()`.


> [!WARNING]
> **Warning**: This method is irreversible.

<br />

#### Parameters

| Name | Type | Description |
|---|---|---|
| `responseId` | `String` | The ID of the form response to delete. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getConfirmationMessage()`

Gets the form's confirmation message.

```javascript
// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Sets the confirmation message to display after someone submits the form.
form.setConfirmationMessage('You successfully submitted the form.');

// Gets the confirmation message and logs it to the console.
const message = form.getConfirmationMessage();

console.log(message);
```

#### Return


`String` --- The form's confirmation message.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getCustomClosedFormMessage()`

Gets the custom message that is displayed if the form is not accepting responses, or an empty
string if no custom message is set.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Sets a custom closed form message to display to the user when the form
// no longer accepts responses.
form.setCustomClosedFormMessage('The form is no longer accepting responses.');

// Gets the custom message set for the form and logs it to the console.
const message = form.getCustomClosedFormMessage();

console.log(message);
```

#### Return


`String` --- The custom message to display if the form is not accepting responses, or an empty
string if no custom message is set.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getDescription()`

Gets the form's description.

```javascript
// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Sets the form description.
form.setDescription('This is the form description.');

// Gets the form description and logs it to the console.
const description = form.getDescription();

console.log(description);
```

#### Return


`String` --- The form's description.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getDestinationId()`

Gets the ID of the form's response destination.

```javascript
// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Creates a spreadsheet to use as the response destination.
const ss = SpreadsheetApp.create('Test_Spreadsheet');

// Updates the form's response destination.
form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());

// Gets the ID of the form's response destination and logs it to the console.
const destinationId = form.getDestinationId();

console.log(destinationId);
```

#### Return


`String` --- The ID of the form's response destination.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getDestinationType()`

Gets the type of the form's response destination.

```javascript
// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc1234556/edit',
);

// Gets the type of the form's response destination and logs it to the console.
const destinationType = form.getDestinationType().name();

console.log(destinationType);
```

#### Return


`https://developers.google.com/apps-script/reference/forms/destination-type` --- The type of the form's response destination.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getEditUrl()`

Gets the URL that can be used to access the form's edit mode.

```javascript
// Opens the form by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Gets the URL that accesses the form's edit mode and logs it to the console.
const url = form.getEditUrl();

console.log(url);
```

#### Return


`String` --- The URL to edit the form.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getEditors()`

Gets the list of editors for this `https://developers.google.com/apps-script/reference/forms/form#`.

#### Return


`https://developers.google.com/apps-script/reference/base/user.html` --- An array of users with edit permission.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getId()`

Gets the ID of the form.

```javascript
// Opens the form by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Gets the ID of the form and logs it to the console.
const id = form.getId();

console.log(id);
```

#### Return


`String` --- The ID of the form.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getItemById(id)`

Gets the item with a given ID. Returns `null` if the ID does not correspond to an item in
the form.

```javascript
// 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);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `id` | `Integer` | The item's ID. |

#### Return


`https://developers.google.com/apps-script/reference/forms/item|null` --- The item with the given ID, or `null` if the item does not exist in the form.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getItems()`

Gets an array of all items in the form.

```javascript
// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Gets the list of items in the form.
const items = form.getItems();

// Gets the type for each item and logs them to the console.
const types = items.map((item) => item.getType().name());

console.log(types);
```

#### Return


`https://developers.google.com/apps-script/reference/forms/item` --- An array of all items in the form.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getItems(itemType)`

Gets an array of all items of a given type.

```javascript
// 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);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `itemType` | `https://developers.google.com/apps-script/reference/forms/item-type` | The type of items to retrieve. |

#### Return


`https://developers.google.com/apps-script/reference/forms/item` --- An array of all items of that type.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getPublishedReaders()`

Gets the list of responders for this `https://developers.google.com/apps-script/reference/forms/form#`.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the responders for the form.
const users = form.getPublishedReaders();
users.forEach(user => console.log(user.getEmail()));
```

#### Return


`https://developers.google.com/apps-script/reference/base/user.html` --- An array of users with responder permission.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getPublishedUrl()`

Gets the URL that can be used to respond to the form.

```javascript
// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Gets the URL to respond to the form and logs it to the console.
const url = form.getPublishedUrl();
console.log(url);
```

#### Return


`String` --- The URL to respond to the form.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getResponse(responseId)`

Gets a single form response based on its response ID. Response IDs can be retrieved from `https://developers.google.com/apps-script/reference/forms/form-response#getId()`.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `responseId` | `String` | The ID for the form response. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form-response` --- The form response.

#### Throws


[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if the response does not exist

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getResponses()`

Gets an array of all of the form's responses.

#### Return


`https://developers.google.com/apps-script/reference/forms/form-response` --- An array of all of the form's responses.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getResponses(timestamp)`

Gets an array of all of the form's responses after a given date and time.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `timestamp` | `Date` | The earliest date and time for which form responses should be returned. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form-response` --- The list of form responses.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getShuffleQuestions()`

Determines whether the order of the questions on each page of the form is randomized.

#### Return


`Boolean` --- `true` if the order of the questions on each page of the form is randomized;
`false` if not.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getSummaryUrl()`

Gets the URL that can be used to view a summary of the form's responses. Unless `https://developers.google.com/apps-script/reference/forms/form#setPublishingSummary(Boolean)` is set to `true`, only the users with edit permission to the
form is able to access the URL.

```javascript
// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// Opens the form by its URL.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Gets the URL to view a summary of the form's responses and logs it to the
// console.
const url = form.getSummaryUrl();
console.log(url);
```

#### Return


`String` --- The URL to view a summary of responses.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `getTitle()`

Gets the form's title.

```javascript
// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Sets the title of the form to 'For_Testing.'
form.setTitle('For_Testing');

// Gets the title of the form and logs it to the console.
const title = form.getTitle();
console.log(title);
```

#### Return


`String` --- The form's title.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `hasLimitOneResponsePerUser()`

Determines whether the form allows only one response per respondent. If the value is `true`, the script cannot submit form responses at all.

#### Return


`Boolean` --- `true` if the form allows only one response per respondent; `false` if not.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `hasProgressBar()`

Determines whether the form displays a progress bar.

```javascript
// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// Opens the form by its URL.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Displays the progress bar on the form.
form.setProgressBar(true);

// Checks if the form displays a progress bar and logs it to the console.
console.log(form.hasProgressBar());
```

#### Return


`Boolean` --- `true` if the form displays a progress bar; `false` if it doesn't.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `hasRespondAgainLink()`

Determines whether the form displays a link to submit another response after a respondent
completes the form.

```javascript
// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Sets the form to display a link to submit another
// response after someone submits the form.
form.setShowLinkToRespondAgain(true);

// Checks if the form displays a 'Submit another response' link and logs it to
// the console.
console.log(form.hasRespondAgainLink());
```

#### Return


`Boolean` --- `true` if the form displays a "Submit another response" link; `false` if it
doesn't.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `isAcceptingResponses()`

Determines whether the form is currently accepting responses. This is overwritten when the
form's publishing state is changed.

```javascript
// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Sets the form to accept responses.
form.setAcceptingResponses(true);

// Checks if the form is accepting responses or not and logs it to the console.
const accepting = form.isAcceptingResponses();
console.log(accepting);
```

#### Return


`Boolean` --- `true` if the form is accepting responses; `false` if it isn't.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `isPublished()`

Determines whether the form is published.

This feature is only available for forms that support publishing. Use `https://developers.google.com/apps-script/reference/forms/form#supportsAdvancedResponderPermissions()` to check if the form supports publishing.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Checks whether the form is published or not and logs it to the console.
console.log(form.isPublished());
```

#### Return


`Boolean` --- `true` if the form is published; `false` if it isn't.

#### Throws


[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if called on unsupported forms.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `isPublishingSummary()`

Determines whether the form displays a link to view a summary of responses after a respondent
completes the form.

```javascript
// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Sets the form to display a link to a summary of
// the responses after someone submits the form.
form.setPublishingSummary(true);

// Checks if the form displays a "See previous responses" link and logs it to
// the console.
const publishingLink = form.isPublishingSummary();
console.log(publishingLink);
```

#### Return


`Boolean` --- `true` if the form displays a "See previous responses" link; `false` if it
doesn't.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `isQuiz()`

Determines whether the form is a quiz.

```javascript
// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Sets the form as a quiz.
form.setIsQuiz(true);

// Checks if the form is a quiz or not and logs it to the console.
console.log(form.isQuiz());
```

#### Return


`Boolean` --- `true` if the form is accepting responses; `false` if it isn't.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `moveItem(from, to)`

Moves an item at a given index among all the items in the form to another given index. Throws a
scripting exception if the `to` index is out of bounds.

```javascript
// 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);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `from` | `Integer` | The current index of the item among all the items in the form. |
| `to` | `Integer` | The new index for the item among all the items in the form. |

#### Return


`https://developers.google.com/apps-script/reference/forms/item` --- The item that was moved.

#### Throws


[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if either index is out of bounds.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `moveItem(item, toIndex)`

Moves a given item to a given index among all the items in the form. Throws a scripting
exception if the given index is out of bounds.

```javascript
// 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);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `item` | `https://developers.google.com/apps-script/reference/forms/item` | The item to move. |
| `toIndex` | `Integer` | The new index for the item among all the items in the form. |

#### Return


`https://developers.google.com/apps-script/reference/forms/item` --- The item that was moved.

#### Throws


[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if the index is out of bounds.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `removeDestination()`

Unlinks the form from its current response destination. The unlinked former destination still
retains a copy of all previous responses. All forms, including those that do not have a
destination set explicitly, [save a
copy of responses in the form's response store](https://support.google.com/drive/answer/2917686). If the form does not currently have a
response destination, this method has no effect.

```javascript
// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Opens a spreadsheet to use for the response destination.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl(
    'https://docs.google.com/spreadsheets/d/abc123456/edit',
);

// Updates the form's response destination to the spreadsheet.
form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());

// Unlinks the form from the spreadsheet.
form.removeDestination();
```

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `removeEditor(emailAddress)`

Removes the given user from the list of editors for the `https://developers.google.com/apps-script/reference/forms/form#`. This method doesn't block
users from accessing the `https://developers.google.com/apps-script/reference/forms/form#` if they belong to a class of users who have general
access---for example, if the `https://developers.google.com/apps-script/reference/forms/form#` is shared with the user's entire domain, or if
the `https://developers.google.com/apps-script/reference/forms/form#` is in a shared drive that the user can access.

For Drive files, this also removes the user from the list of viewers and responders.

```javascript
// Opens the Forms file by its URL.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Removes the editor from the form.
// TODO(developer): replace the emailAddress.
form.removeEditor('editor@uni.edu');
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `emailAddress` | `String` | The email address of the user to remove. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `removeEditor(user)`

Removes the given user from the list of editors for the `https://developers.google.com/apps-script/reference/forms/form#`. This method doesn't block
users from accessing the `https://developers.google.com/apps-script/reference/forms/form#` if they belong to a class of users who have general
access---for example, if the `https://developers.google.com/apps-script/reference/forms/form#` is shared with the user's entire domain, or if
the `https://developers.google.com/apps-script/reference/forms/form#` is in a shared drive that the user can access.

For Drive files, this also removes the user from the list of viewers.

```javascript
// Opens the Forms file by its URL.
// TODO(developer): Replace the URL with your own.
const form1 = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the editors from the form.
const users = form1.getEditors();

// Opens another form.
// TODO(developer): Replace the URL with your own.
const form2 = FormApp.openByUrl('https://docs.google.com/forms/d/efg123456/edit');

// Removes editors from the form.
users.forEach(user => form2.removeEditor(user));
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `user` | `https://developers.google.com/apps-script/reference/base/user.html` | A representation of the user to remove. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `removePublishedReader(emailAddress)`

Removes the given user from the list of responders for the `https://developers.google.com/apps-script/reference/forms/form#`. This method doesn't
block users from accessing the `https://developers.google.com/apps-script/reference/forms/form#` if they belong to a class of users who have general
access---for example, if the `https://developers.google.com/apps-script/reference/forms/form#` is shared with the user's entire domain, or if
the `https://developers.google.com/apps-script/reference/forms/form#` is in a shared drive that the user can access.

For Drive files, this also removes the user from the list of viewers and editors.

```javascript
// Opens the Forms file by its URL.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Removes the responders from the form.
// TODO(developer): replace the emailAddress.
form.removePublishedReader('responder1@uni.edu');
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `emailAddress` | `String` | The email address of the user to remove. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `removePublishedReader(user)`

Removes the given user from the list of responders for the `https://developers.google.com/apps-script/reference/forms/form#`. This method doesn't
block users from accessing the `https://developers.google.com/apps-script/reference/forms/form#` if they belong to a class of users who have general
access---for example, if the `https://developers.google.com/apps-script/reference/forms/form#` is shared with the user's entire domain, or if
the `https://developers.google.com/apps-script/reference/forms/form#` is in a shared drive that the user can access.

For Drive files, this also removes the user from the list of viewers and editors.

```javascript
// Opens the Forms file by its URL.
// TODO(developer): Replace the URL with your own.
const form1 = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the responders from the form.
const users = form1.getPublishedReaders();

// Opens another form.
// TODO(developer): Replace the URL with your own.
const form2 = FormApp.openByUrl('https://docs.google.com/forms/d/efg123456/edit');

// Removes responders from the form.
users.forEach(user => form2.removePublishedReader(user));
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `user` | `https://developers.google.com/apps-script/reference/base/user.html` | A representation of the user to remove. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `setAcceptingResponses(enabled)`

Sets whether the form is currently accepting responses. The default for new forms is `true`. The state is overwritten when the publish state of the form is changed.

```javascript
// 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());
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `enabled` | `Boolean` | `true` if the form should accept responses; `false` if it shouldn't. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Throws


[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if enabled on an unpublished form.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `setAllowResponseEdits(enabled)`

Sets whether the form displays a link to edit a response after submitting it. The default for
new forms is `false`.

Regardless of this setting, the method `https://developers.google.com/apps-script/reference/forms/form-response#getEditResponseUrl()` allows a
script author who has edit permission to the form to generate a URL that can be used to edit a
response.

```javascript
// 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());
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `enabled` | `Boolean` | `true` if the form should display an "Edit your response" link; `false` if not. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `setCollectEmail(collect)`

Sets whether the form collects respondents' email addresses. The default for new forms is
`false`.

```javascript
// 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);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `collect` | `Boolean` | `true` if the form should collect email addresses; `false` if it doesn't. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `setConfirmationMessage(message)`

Sets the form's confirmation message.

```javascript
// 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);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `message` | `String` | The form's new confirmation message. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `setCustomClosedFormMessage(message)`

Sets the message to display if the form is not accepting responses. If no message is set, the
form uses a default message.

```javascript
// 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);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `message` | `String` | The message to display if the form is not accepting responses. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `setDescription(description)`

Sets the form's description.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `description` | `String` | The form's new description. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `setDestination(type, id)`

Sets the destination where form responses are saved. All forms, including those that do not
have a destination set explicitly, [save a copy of responses in the form's
response store](https://support.google.com/drive/answer/2917686).

#### Parameters

| Name | Type | Description |
|---|---|---|
| `type` | `https://developers.google.com/apps-script/reference/forms/destination-type` | The type of the form's response destination. |
| `id` | `String` | The ID of the form's response destination. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Throws


[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if the given destination ID is invalid

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `setIsQuiz(enabled)`

Sets whether the form is a quiz. The default for new forms is `false`.

Graded questions are only allowed in Quizzes, so setting this to `false` causes all
grading options to be removed from all questions.

Quiz settings are only available in the new Forms UI; making a form a Quiz opts the form
into using the new UI.

```javascript
// 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());
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `enabled` | `Boolean` | `true` if quiz features should be enabled for the form; `false` if not. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `setLimitOneResponsePerUser(enabled)`

Sets whether the form allows only one response per respondent. The default for new forms is
`false`. If the value is set to `true`, the script cannot submit form responses at
all.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `enabled` | `Boolean` | `true` if the form should allow only one response per respondent; `false` if not. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `setProgressBar(enabled)`

Sets whether the form has a progress bar. The default for new forms is `false`.

```javascript
// 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());
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `enabled` | `Boolean` | `true` if the form displays a progress bar; `false` if it doesn't. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `setPublished(enabled)`

Sets whether the form is published. The default for new forms is `true`.

This feature is only available for forms that support publishing. Use `https://developers.google.com/apps-script/reference/forms/form#supportsAdvancedResponderPermissions()` to check if the form supports publishing.

A form needs to be published for it to be accessible to responders. This method supersedes
calls to `https://developers.google.com/apps-script/reference/forms/form#setAcceptingResponses(Boolean)`.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Publishes the form before sharing it.
form.setPublished(true);

// Checks whether the form is published or not and logs it to the console.
console.log(form.isPublished());
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `enabled` | `Boolean` | `true` if the form should be published, `false` if not. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Throws


[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if called on unsupported forms.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `setPublishingSummary(enabled)`

Sets whether the form displays a link to view a summary of responses after a respondent submits
the form. The default for new forms is `false`.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `enabled` | `Boolean` | `true` if the form should display a "See previous responses" link; `false` if not. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `setShowLinkToRespondAgain(enabled)`

Sets whether the form displays a link to submit another response after a respondent completes
the form. The default for new forms is `true`.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `enabled` | `Boolean` | `true` if the form should display a "Submit another response" link; `false` if not. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `setShuffleQuestions(shuffle)`

Sets whether the order of the questions on each page of the form is randomized.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `shuffle` | `Boolean` | `true` if the order of the questions on each page of the form should be randomized; `false` if not. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `setTitle(title)`

Sets the form's title.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `title` | `String` | The form's new title. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `shortenFormUrl(url)`

Converts a long URL for a form to a short URL. Throws an exception if the long URL does not
belong to Google Forms.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `url` | `String` | The URL to shorten. |

#### Return


`String` --- A URL in the form `http://goo.gl/forms/1234`.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `submitGrades(responses)`

Submits grades for the given FormResponses.

If your code includes an `onFormSubmit` trigger, calling `submitGrades()`
triggers the `onFormSubmit` condition and causes an infinite loop. To prevent the
infinite loop, add code that checks whether grades already exist before calling `submitGrades()`.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `responses` | `https://developers.google.com/apps-script/reference/forms/form-response` | An array of all of the form's responses. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- This `https://developers.google.com/apps-script/reference/forms/form#`, for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

*** ** * ** ***

### `supportsAdvancedResponderPermissions()`

Determines whether the form supports publishing. This method is used to determine whether the
`https://developers.google.com/apps-script/reference/forms/form#setPublished(Boolean)` and `https://developers.google.com/apps-script/reference/forms/form#isPublished()` methods, and responder permissions,
are available.

```javascript
// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Checks whether the form supports publishing or not and logs it to the
// console.
console.log(form.supportsAdvancedResponderPermissions());
```

#### Return


`Boolean` --- `true` if the form supports publishing; `false` if it doesn't.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`

## Deprecated methods

### `requiresLogin()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Determines whether the form requires respondents to log in to an account in the same domain or
a subdomain before responding.

```javascript
// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl(
    'https://docs.google.com/forms/d/abc123456/edit',
);

// Checks if the form requires respondents to log in to a Google Workspace
// account before responding and logs it to the console.
const login = form.requiresLogin();
console.log(login);
```

#### Return


`Boolean` --- `true` if the form requires users to log in; `false` if it doesn't.

*** ** * ** ***

### `setRequireLogin(requireLogin)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets whether the form requires respondents to log in to an account in the same domain or a
subdomain before responding. The default for new forms is `false` unless a domain
administrator changes the default.

This feature is available only for forms created by Google Workspace users. Users of other
types of Google accounts can't be required to log in.

```javascript
// 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());
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `requireLogin` | `Boolean` | `true` if the form requires users to log in; `false` if it doesn't. |

#### Return


`https://developers.google.com/apps-script/reference/forms/form#` --- The current form (for chaining).

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/forms.currentonly`
- `https://www.googleapis.com/auth/forms`