Skip to content

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.Form

Start 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.

Code.gs
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.Form
Show example code
Code.gs
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.Form
Show example code
Code.gs
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.Form
Show example code
Code.gs
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

From signature data Google source
  • addCheckboxGridItem(): FormApp.CheckboxGridItem

addCheckboxItem

From signature data Google source
  • addCheckboxItem(): FormApp.CheckboxItem

addDateItem

From signature data Google source
  • addDateItem(): FormApp.DateItem

addDateTimeItem

From signature data Google source
  • addDateTimeItem(): FormApp.DateTimeItem

addDurationItem

From signature data Google source
  • addDurationItem(): FormApp.DurationItem

addEditor

From signature data Google source
  • addEditor(emailAddress: string): FormApp.Form
  • addEditor(user: User): FormApp.Form

addEditors

From signature data Google source
  • addEditors(emailAddresses: string[]): FormApp.Form

addGridItem

From signature data Google source
  • addGridItem(): FormApp.GridItem

addImageItem

From signature data Google source
  • addImageItem(): FormApp.ImageItem

addListItem

From signature data Google source
  • addListItem(): FormApp.ListItem

addMultipleChoiceItem

From signature data Google source
  • addMultipleChoiceItem(): FormApp.MultipleChoiceItem

addPageBreakItem

From signature data Google source
  • addPageBreakItem(): FormApp.PageBreakItem

addParagraphTextItem

From signature data Google source
  • addParagraphTextItem(): FormApp.ParagraphTextItem

addPublishedReader

From signature data Google source
  • addPublishedReader(emailAddress: string): FormApp.Form
  • addPublishedReader(user: User): FormApp.Form

addPublishedReaders

From signature data Google source
  • addPublishedReaders(emailAddresses: string[]): FormApp.Form

addRatingItem

From signature data Google source
  • addRatingItem(): FormApp.RatingItem

addScaleItem

From signature data Google source
  • addScaleItem(): FormApp.ScaleItem

addSectionHeaderItem

From signature data Google source
  • addSectionHeaderItem(): FormApp.SectionHeaderItem

addTextItem

From signature data Google source
  • addTextItem(): FormApp.TextItem

addTimeItem

From signature data Google source
  • addTimeItem(): FormApp.TimeItem

addVideoItem

From signature data Google source
  • addVideoItem(): FormApp.VideoItem

canEditResponse

From signature data Google source
  • canEditResponse(): boolean

collectsEmail

From signature data Google source
  • collectsEmail(): boolean

createResponse

From signature data Google source
  • createResponse(): FormApp.FormResponse

deleteAllResponses

From signature data Google source
  • deleteAllResponses(): FormApp.Form

deleteItem

From signature data Google source
  • deleteItem(item: FormApp.Item): void
  • deleteItem(index: number): void

deleteResponse

From signature data Google source
  • deleteResponse(responseId: string): FormApp.Form

getConfirmationMessage

From signature data Google source
  • getConfirmationMessage(): string

getCustomClosedFormMessage

From signature data Google source
  • getCustomClosedFormMessage(): string

getDescription

From signature data Google source
  • getDescription(): string

getDestinationId

From signature data Google source
  • getDestinationId(): string

getDestinationType

From signature data Google source
  • getDestinationType(): FormApp.DestinationType

getEditUrl

From signature data Google source
  • getEditUrl(): string

getEditors

From signature data Google source
  • getEditors(): User[]

getId

From signature data Google source
  • getId(): string

getItemById

From signature data Google source
  • getItemById(id: number): FormApp.Item | null

getItems

From signature data Google source
  • getItems(): FormApp.Item[]
  • getItems(itemType: FormApp.ItemType): FormApp.Item[]

getPublishedReaders

From signature data Google source
  • getPublishedReaders(): User[]

getPublishedUrl

From signature data Google source
  • getPublishedUrl(): string

getResponse

From signature data Google source
  • getResponse(responseId: string): FormApp.FormResponse

getResponses

From signature data Google source
  • getResponses(): FormApp.FormResponse[]
  • getResponses(timestamp: Date): FormApp.FormResponse[]

getShuffleQuestions

From signature data Google source
  • getShuffleQuestions(): boolean

getSummaryUrl

From signature data Google source
  • getSummaryUrl(): string

getTitle

From signature data Google source
  • getTitle(): string

hasLimitOneResponsePerUser

From signature data Google source
  • hasLimitOneResponsePerUser(): boolean

hasProgressBar

From signature data Google source
  • hasProgressBar(): boolean
From signature data Google source
  • hasRespondAgainLink(): boolean

isAcceptingResponses

From signature data Google source
  • isAcceptingResponses(): boolean

isPublished

From signature data Google source
  • isPublished(): boolean

isPublishingSummary

From signature data Google source
  • isPublishingSummary(): boolean

isQuiz

From signature data Google source
  • isQuiz(): boolean

moveItem

From signature data Google source
  • moveItem(from: number, to: number): FormApp.Item
  • moveItem(item: FormApp.Item, toIndex: number): FormApp.Item

removeDestination

From signature data Google source
  • removeDestination(): FormApp.Form

removeEditor

From signature data Google source
  • removeEditor(emailAddress: string): FormApp.Form
  • removeEditor(user: User): FormApp.Form

removePublishedReader

From signature data Google source
  • removePublishedReader(emailAddress: string): FormApp.Form
  • removePublishedReader(user: User): FormApp.Form

requiresLogin

From signature data Google source
  • requiresLogin(): boolean

setAcceptingResponses

From signature data Google source
  • setAcceptingResponses(enabled: boolean): FormApp.Form

setAllowResponseEdits

From signature data Google source
  • setAllowResponseEdits(enabled: boolean): FormApp.Form

setCollectEmail

From signature data Google source
  • setCollectEmail(enabled: boolean): FormApp.Form

setConfirmationMessage

From signature data Google source
  • setConfirmationMessage(message: string): FormApp.Form

setCustomClosedFormMessage

From signature data Google source
  • setCustomClosedFormMessage(message: string): FormApp.Form

setDescription

From signature data Google source
  • setDescription(description: string): FormApp.Form

setDestination

From signature data Google source
  • setDestination(type: FormApp.DestinationType, id: string): FormApp.Form

setIsQuiz

From signature data Google source
  • setIsQuiz(enabled: boolean): FormApp.Form

setLimitOneResponsePerUser

From signature data Google source
  • setLimitOneResponsePerUser(enabled: boolean): FormApp.Form

setProgressBar

From signature data Google source
  • setProgressBar(enabled: boolean): FormApp.Form

setPublished

From signature data Google source
  • setPublished(enabled: boolean): FormApp.Form

setPublishingSummary

From signature data Google source
  • setPublishingSummary(enabled: boolean): FormApp.Form

setRequireLogin

From signature data Google source
  • setRequireLogin(requireLogin: boolean): FormApp.Form

setShowLinkToRespondAgain

From signature data Google source
  • setShowLinkToRespondAgain(enabled: boolean): FormApp.Form

setShuffleQuestions

From signature data Google source
  • setShuffleQuestions(shuffle: boolean): FormApp.Form

setTitle

From signature data Google source
  • setTitle(title: string): FormApp.Form

shortenFormUrl

From signature data Google source
  • shortenFormUrl(url: string): string

submitGrades

From signature data Google source
  • submitGrades(responses: FormApp.FormResponse[]): FormApp.Form

supportsAdvancedResponderPermissions

From signature data Google source
  • 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