Object reference
Form
A FormApp.Form is the Google Form itself. Reach it with FormApp.getActiveForm() or openById(id) to read its questions with getItems() or count submissions with getResponses().
FormApp.FormStart here
Get this object first
For a script opened from a Google Form, get the active form to work with that open file. If your script is not bound to a form, use FormApp.openById with the form ID instead.
function showFormTitle() {
const form = FormApp.getActiveForm();
if (!form) throw new Error('Run this from a script bound to a Google Form.');
Logger.log(form.getTitle());
} Then use it
Common actions
Choose an action, then open its example only when you need the code.
List the question titles
This lists the title of each item on the form and does not change any of them.
FormApp.FormShow example code
function logFormItemTitles() {
const form = FormApp.getActiveForm();
if (!form) throw new Error('Run this from a script bound to a Google Form.');
const titles = form.getItems().map((item) => item.getTitle());
Logger.log(titles.join(', ') || 'No items');
} Count the responses
This counts how many responses have been submitted to the form and does not change any of them.
FormApp.FormShow example code
function logFormResponseCount() {
const form = FormApp.getActiveForm();
if (!form) throw new Error('Run this from a script bound to a Google Form.');
Logger.log(form.getResponses().length);
} Get the published URL
This reads the link people use to fill out the form and does not change the form.
FormApp.FormShow example code
function logFormPublishedUrl() {
const form = FormApp.getActiveForm();
if (!form) throw new Error('Run this from a script bound to a Google Form.');
Logger.log(form.getPublishedUrl());
} Technical reference
Exact names and signatures
Generated runtime and signature facts stay separate from the beginner actions above. Open method details only when you need them.
At a glance
- Service
- FormApp
- Reference symbol
FormApp.Form- Object
Form- Runtime
- From signature data
Methods and signatures
Browse 75 methods
addCheckboxGridItem
- addCheckboxGridItem(): FormApp.CheckboxGridItem
addCheckboxItem
- addCheckboxItem(): FormApp.CheckboxItem
addDateItem
- addDateItem(): FormApp.DateItem
addDateTimeItem
- addDateTimeItem(): FormApp.DateTimeItem
addDurationItem
- addDurationItem(): FormApp.DurationItem
addEditor
- addEditor(emailAddress: string): FormApp.Form
- addEditor(user: User): FormApp.Form
addEditors
- addEditors(emailAddresses: string[]): FormApp.Form
addGridItem
- addGridItem(): FormApp.GridItem
addImageItem
- addImageItem(): FormApp.ImageItem
addListItem
- addListItem(): FormApp.ListItem
addMultipleChoiceItem
- addMultipleChoiceItem(): FormApp.MultipleChoiceItem
addPageBreakItem
- addPageBreakItem(): FormApp.PageBreakItem
addParagraphTextItem
- addParagraphTextItem(): FormApp.ParagraphTextItem
addPublishedReader
- addPublishedReader(emailAddress: string): FormApp.Form
- addPublishedReader(user: User): FormApp.Form
addPublishedReaders
- addPublishedReaders(emailAddresses: string[]): FormApp.Form
addRatingItem
- addRatingItem(): FormApp.RatingItem
addScaleItem
- addScaleItem(): FormApp.ScaleItem
addSectionHeaderItem
- addSectionHeaderItem(): FormApp.SectionHeaderItem
addTextItem
- addTextItem(): FormApp.TextItem
addTimeItem
- addTimeItem(): FormApp.TimeItem
addVideoItem
- addVideoItem(): FormApp.VideoItem
canEditResponse
- canEditResponse(): boolean
collectsEmail
- collectsEmail(): boolean
createResponse
- createResponse(): FormApp.FormResponse
deleteAllResponses
- deleteAllResponses(): FormApp.Form
deleteItem
- deleteItem(item: FormApp.Item): void
- deleteItem(index: number): void
deleteResponse
- deleteResponse(responseId: string): FormApp.Form
getConfirmationMessage
- getConfirmationMessage(): string
getCustomClosedFormMessage
- getCustomClosedFormMessage(): string
getDescription
- getDescription(): string
getDestinationId
- getDestinationId(): string
getDestinationType
- getDestinationType(): FormApp.DestinationType
getEditUrl
- getEditUrl(): string
getEditors
- getEditors(): User[]
getId
- getId(): string
getItemById
- getItemById(id: number): FormApp.Item | null
getItems
- getItems(): FormApp.Item[]
- getItems(itemType: FormApp.ItemType): FormApp.Item[]
getPublishedReaders
- getPublishedReaders(): User[]
getPublishedUrl
- getPublishedUrl(): string
getResponse
- getResponse(responseId: string): FormApp.FormResponse
getResponses
- getResponses(): FormApp.FormResponse[]
- getResponses(timestamp: Date): FormApp.FormResponse[]
getShuffleQuestions
- getShuffleQuestions(): boolean
getSummaryUrl
- getSummaryUrl(): string
getTitle
- getTitle(): string
hasLimitOneResponsePerUser
- hasLimitOneResponsePerUser(): boolean
hasProgressBar
- hasProgressBar(): boolean
hasRespondAgainLink
- hasRespondAgainLink(): boolean
isAcceptingResponses
- isAcceptingResponses(): boolean
isPublished
- isPublished(): boolean
isPublishingSummary
- isPublishingSummary(): boolean
isQuiz
- isQuiz(): boolean
moveItem
- moveItem(from: number, to: number): FormApp.Item
- moveItem(item: FormApp.Item, toIndex: number): FormApp.Item
removeDestination
- removeDestination(): FormApp.Form
removeEditor
- removeEditor(emailAddress: string): FormApp.Form
- removeEditor(user: User): FormApp.Form
removePublishedReader
- removePublishedReader(emailAddress: string): FormApp.Form
- removePublishedReader(user: User): FormApp.Form
requiresLogin
- requiresLogin(): boolean
setAcceptingResponses
- setAcceptingResponses(enabled: boolean): FormApp.Form
setAllowResponseEdits
- setAllowResponseEdits(enabled: boolean): FormApp.Form
setCollectEmail
- setCollectEmail(enabled: boolean): FormApp.Form
setConfirmationMessage
- setConfirmationMessage(message: string): FormApp.Form
setCustomClosedFormMessage
- setCustomClosedFormMessage(message: string): FormApp.Form
setDescription
- setDescription(description: string): FormApp.Form
setDestination
- setDestination(type: FormApp.DestinationType, id: string): FormApp.Form
setIsQuiz
- setIsQuiz(enabled: boolean): FormApp.Form
setLimitOneResponsePerUser
- setLimitOneResponsePerUser(enabled: boolean): FormApp.Form
setProgressBar
- setProgressBar(enabled: boolean): FormApp.Form
setPublished
- setPublished(enabled: boolean): FormApp.Form
setPublishingSummary
- setPublishingSummary(enabled: boolean): FormApp.Form
setRequireLogin
- setRequireLogin(requireLogin: boolean): FormApp.Form
setShowLinkToRespondAgain
- setShowLinkToRespondAgain(enabled: boolean): FormApp.Form
setShuffleQuestions
- setShuffleQuestions(shuffle: boolean): FormApp.Form
setTitle
- setTitle(title: string): FormApp.Form
shortenFormUrl
- shortenFormUrl(url: string): string
submitGrades
- submitGrades(responses: FormApp.FormResponse[]): FormApp.Form
supportsAdvancedResponderPermissions
- supportsAdvancedResponderPermissions(): boolean
Need the whole workflow?
Return to a task guide
Task guides cover setup, permissions, expected results, and troubleshooting as well as object methods.
Browse Google Forms tasks