今日からGoogleフォームで使えるGASのコード一覧

templateLogo_FormApp
URLをコピーする
URLをコピーしました!
目次

Googleフォームで使えるGASのコード一覧

本記事では、Google Apps ScriptでGoogleフォームに対して使うことができるFormAppという処理の一覧表を用意しました。

Google公式ドキュメントは英語表記しかありませんので、分かりづらいため、みなさんがそこで挫折しないように日本語出ないようが把握できるようにしています。

まだすべてのメソッドで日本語での使い方が解説できているわけではありませんが、最終的にはすべての使い方を日本語で解説するページを用意していきます。

日本語化されている記事の見分け方は、簡単な説明列で日本語が記載されているものについては日本語記事が用意できています。

メソッド名をクリックすることで対象の記事にリンクしています。

日本語の記事が出来上がっていないメソッドについてはGoogleから提供されている公式ドキュメント(英語)へのリンクとなっています。

FormAppの概要

FormAppとは、Google Apps ScriptでGoogleフォームに対する操作を行うコードですが、FormAppに用意されているメソッドでは、次のような操作を行うことができます。

  • フォームファイルの作成
  • フォーム質問の作成
  • 保存先のスプレッドシートの設定
  • 送信済みの回答を取得

クラス名一覧

CheckboxGridItemCheckboxGridValidationCheckboxGridValidationBuilder
CheckboxItemCheckboxValidationCheckboxValidationBuilder
ChoiceDateItemDateTimeItem
DurationItemFormFormResponse
GridItemGridValidationGridValidationBuilder
ImageItemItemResponseListItem
MultipleChoiceItemPageBreakItemParagraphTextItem
ParagraphTextValidationParagraphTextValidationBuilderQuizFeedback
QuizFeedbackBuilderScaleItemSectionHeaderItem
TextItemTextValidationTextValidationBuilder
TimeItemVideoItem

※クリックすると対象場所にジャンプします

クラス別メソッド名一覧

Class CheckboxGridItem

スクロールできます
メソッド名返り値簡単な説明
clearValidationCheckboxGridItemRemoves any data validation for this grid item.
createResponseItemResponseCreates a new ItemResponse for this checkbox grid item.
duplicateCheckboxGridItemCreates a copy of this item and appends it to the end of the form.
getColumnsString[]Gets the values for every column in the grid.
getHelpTextStringGets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
getIdIntegerGets the item’s unique identifier.
getIndexIntegerGets the index of the item among all the items in the form.
getRowsString[]Gets the values for every row in the grid.
getTitleStringGets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
getTypeItemTypeGets the item’s type, represented as an ItemType.
isRequiredBooleanDetermines whether the respondent must answer the question.
setColumnsCheckboxGridItemSets the columns of the grid based on an array of values.
setHelpTextCheckboxGridItemSets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
setRequiredCheckboxGridItemSets whether the respondent must answer the question.
setRowsCheckboxGridItemSets the rows of the grid based on an array of values.
setTitleCheckboxGridItemSets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
setValidationCheckboxGridItemSets the data validation for this checkbox grid item.

Class CheckboxGridValidation

Class CheckboxGridValidationBuilder

スクロールできます
メソッド名返り値簡単な説明
requireLimitOneResponsePerColumn CheckboxGridValidationBuilderRequires limit of one response per column for a grid item.

Class CheckboxItem

メソッド名返り値簡単な説明
clearValidationCheckboxItemRemoves any data validation for this checkbox item.
createChoiceChoiceCreates a new choice.
createResponseItemResponseCreates a new ItemResponse for this checkbox item.
duplicateCheckboxItemCreates a copy of this item and appends it to the end of the form.
getChoicesChoice[]Gets all choices for an item.
getFeedbackForCorrectQuizFeedbackReturns the feedback that is shown to respondents when they respond correctly to a question.
getHelpTextQuizFeedbackGets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
getIdStringGets the item’s unique identifier.
getIndexIntegerGets the index of the item among all the items in the form.
getPointsIntegerReturns the point value of a gradeable item.
getTitleIntegerGets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
getTypeStringGets the item’s type, represented as an ItemType.
hasOtherOptionItemTypeDetermines whether the item has an “other” option.
isRequiredBooleanDetermines whether the respondent must answer the question.
setChoiceValuesBooleanSets the choices for an item from an array of strings.
setChoicesCheckboxItemSets an array of choices for an item.
setFeedbackForCorrectCheckboxItemSets the feedback to be shown to respondents when they respond correctly to a question.
setFeedbackForIncorrectCheckboxItemSets the feedback to be shown to respondents when they respond incorrectly to a question.
setHelpTextCheckboxItemSets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
setPointsCheckboxItemSets the number of points a gradeable item is worth.
setRequiredCheckboxItemSets whether the respondent must answer the question.
setTitleCheckboxItemSets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
setValidationCheckboxItemSets the data validation for this checkbox item.
showOtherOptionCheckboxItemSets whether the item has an “other” option.

Class CheckboxValidation

Class CheckboxValidationBuilder

メソッド名返り値簡単な説明
requireSelectAtLeastCheckboxValidationBuilderRequire at least this many choices to be selected.
requireSelectAtMostCheckboxValidationBuilderRequire at most this many choices to be selected.
requireSelectExactlyCheckboxValidationBuilderRequire exactly this many choices to be selected.

Class Choice

スクロールできます
メソッド名返り値簡単な説明
getGotoPagePageBreakItemGets the PageBreakItem set as a GO_TO_PAGE destination if the responder selects this choice and completes the current page.
getPageNavigationTypePageNavigationTypeGets the PageNavigationType that occurs if the responder selects this choice and completes the current page.
getValueStringGets the choice’s value, which respondents see as a label when viewing the form.
isCorrectAnswerBooleanGets whether the choice is a correct answer for the question.

Class DateItem

スクロールできます
メソッド名返り値簡単な説明
createResponseItemResponseCreates a new ItemResponse for this date item.
duplicateDateItemCreates a copy of this item and appends it to the end of the form.
getGeneralFeedbackQuizFeedbackReturns the feedback that is shown to respondents when they respond to a gradeable question.
getHelpTextStringGets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
getIdIntegerGets the item’s unique identifier.
getIndexIntegerGets the index of the item among all the items in the form.
getPointsIntegerReturns the point value of a gradeable item.
getTitleStringGets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
getTypeItemTypeGets the item’s type, represented as an ItemType.
includesYearBooleanDetermines whether the date item includes a year option.
isRequiredBooleanDetermines whether the respondent must answer the question.
setGeneralFeedbackDateItemSets the feedback to be shown to respondents when they respond to a gradeable question that doesn’t have a correct or incorrect answer (ie questions that require manual grading).
setHelpTextDateItemSets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
setIncludesYearDateItemSets whether the date item includes a year setting.
setPointsDateItemSets the number of points a gradeable item is worth.
setRequiredDateItemSets whether the respondent must answer the question.
setTitleDateItemSets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).

Class DateTimeItem

スクロールできます
メソッド名返り値簡単な説明
createResponseItemResponseCreates a new ItemResponse for this date-time item.
duplicateDateTimeItemCreates a copy of this item and appends it to the end of the form.
getGeneralFeedbackQuizFeedbackReturns the feedback that is shown to respondents when they respond to a gradeable question.
getHelpTextStringGets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
getIdIntegerGets the item’s unique identifier.
getIndexIntegerGets the index of the item among all the items in the form.
getPointsIntegerReturns the point value of a gradeable item.
getTitleStringGets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
getTypeItemTypeGets the item’s type, represented as an ItemType.
includesYearBooleanDetermines whether the date item includes a year option.
isRequiredBooleanDetermines whether the respondent must answer the question.
setGeneralFeedbackDateTimeItemSets the feedback to be shown to respondents when they respond to a gradeable question that doesn’t have a correct or incorrect answer (ie questions that require manual grading).
setHelpTextDateTimeItemSets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
setIncludesYearDateTimeItemSets whether the date item includes a year setting.
setPointsDateTimeItemSets the number of points a gradeable item is worth.
setRequiredDateTimeItemSets whether the respondent must answer the question.
setTitleDateTimeItemSets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).

Class DurationItem

スクロールできます
メソッド名返り値簡単な説明
createResponseItemResponseCreates a new ItemResponse for this date item.
duplicateDurationItemCreates a copy of this item and appends it to the end of the form.
getGeneralFeedbackQuizFeedbackReturns the feedback that is shown to respondents when they respond to a gradeable question.
getHelpTextStringGets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
getIdIntegerGets the item’s unique identifier.
getIndexIntegerGets the index of the item among all the items in the form.
getPointsIntegerReturns the point value of a gradeable item.
getTitleStringGets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
getTypeItemTypeGets the item’s type, represented as an ItemType.
isRequiredBooleanDetermines whether the respondent must answer the question.
setGeneralFeedbackDurationItemSets the feedback to be shown to respondents when they respond to a gradeable question that doesn’t have a correct or incorrect answer (ie questions that require manual grading).
setHelpTextDurationItemSets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
setPointsDurationItemSets the number of points a gradeable item is worth.
setRequiredDurationItemSets whether the respondent must answer the question.
setTitleDurationItemSets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).

Class Form

スクロールできます
メソッド名返り値簡単な説明
addCheckboxGridItemCheckboxGridItemAppends 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.
addCheckboxItemCheckboxItemAppends a new question item that allows the respondent to select one or more checkboxes, as well as an optional “other” field.
addDateItemDateItemAppends a new question item that allows the respondent to indicate a date.
addDateTimeItemDateTimeItemAppends a new question item that allows the respondent to indicate a date and time.
addDurationItemDurationItemAppends a new question item that allows the respondent to indicate a length of time.
addEditorFormAdds the given user to the list of editors for the Form.
addEditorsFormAdds the given array of users to the list of editors for the Form.
addGridItemGridItemAppends 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.
addImageItemImageItemAppends a new layout item that displays an image.
addListItemListItemAppends a new question item that allows the respondent to select one choice from a drop-down list.
addMultipleChoiceItemMultipleChoiceItemAppends a new question item that allows the respondent to select one choice from a list of radio buttons or an optional “other” field.
addPageBreakItemPageBreakItemAppends a new layout item that marks the start of a page.
addParagraphTextItemParagraphTextItemAppends a new question item that allows the respondent to enter a block of text.
addScaleItemScaleItemAppends a new question item that allows the respondent to choose one option from a numbered sequence of radio buttons.
addSectionHeaderItemSectionHeaderItemAppends a new layout item that visually indicates the start of a section.
addTextItemTextItemAppends a new question item that allows the respondent to enter a single line of text.
addTimeItemTimeItemAppends a new question item that allows the respondent to indicate a time of day.
addVideoItemVideoItemAppends a new layout item that displays a video.
canEditResponseBooleanDetermines whether the form displays a link to edit a response after submitting it.
collectsEmailBooleanDetermines whether the form collects respondents’ email addresses.
createResponseFormResponseCreates a new response to the form.
deleteAllResponsesFormDeletes all submitted responses from the form’s response store.
deleteItemvoidDeletes the item at a given index among all the items in the form.
deleteResponseFormDeletes a single response from the form’s response store.
getConfirmationMessageStringGets the form’s confirmation message.
getCustomClosedFormMessageStringGets the custom message that will be displayed if the form is not accepting responses, or an empty string if no custom message has been set.
getDescriptionStringGets the form’s description.
getDestinationIdStringGets the ID of the form’s response destination.
getDestinationTypeDestinationTypeGets the type of the form’s response destination.
getEditUrlStringGets the URL that can be used to access the form’s edit mode.
getEditorsUser[]Gets the list of editors for this Form.
getIdStringGets the ID of the form.
getItemByIdItemGets the item with a given ID.
getItemsItem[]Gets an array of all items in the form.
getPublishedUrlStringGets the URL that can be used to respond to the form.
getResponseFormResponseGets a single form response based on its response ID.
getResponsesFormResponse[]Gets an array of all of the form’s responses.
getShuffleQuestionsBooleanDetermines whether the order of the questions on each page of the form is randomized.
getSummaryUrlStringGets the URL that can be used to view a summary of the form’s responses.
getTitleStringGets the form’s title.
hasLimitOneResponsePerUserBooleanDetermines whether the form allows only one response per respondent.
hasProgressBarBooleanDetermines whether the form displays a progress bar.
hasRespondAgainLinkBooleanDetermines whether the form displays a link to submit another response after a respondent completes the form.
isAcceptingResponsesBooleanDetermines whether the form is currently accepting responses.
isPublishingSummaryBooleanDetermines whether the form displays a link to view a summary of responses after a respondent completes the form.
isQuizBooleanDetermines whether the form is a quiz.
moveItemItemMoves an item at a given index among all the items in the form to another given index.
removeDestinationFormUnlinks the form from its current response destination.
removeEditorFormRemoves the given user from the list of editors for the Form.
requiresLoginBooleanDetermines whether the form requires respondents to log in to an account in the same domain or a subdomain before responding.
setAcceptingResponsesFormSets whether the form is currently accepting responses.
setAllowResponseEditsFormSets whether the form displays a link to edit a response after submitting it.
setCollectEmailFormSets whether the form collects respondents’ email addresses.
setConfirmationMessageFormSets the form’s confirmation message.
setCustomClosedFormMessageFormSets the message to display if the form is not accepting responses.
setDescriptionFormSets the form’s description.
setDestinationFormSets the destination where form responses are saved.
setIsQuizFormSets whether the form is a quiz.
setLimitOneResponsePerUserFormSets whether the form allows only one response per respondent.
setProgressBarFormSets whether the form has a progress bar.
setPublishingSummaryFormSets whether the form displays a link to view a summary of responses after a respondent submits the form.
setRequireLoginFormSets whether the form requires respondents to log in to an account in the same domain or a subdomain before responding.
setShowLinkToRespondAgainFormSets whether the form displays a link to submit another response after a respondent completes the form.
setShuffleQuestionsFormSets whether the order of the questions on each page of the form is randomized.
setTitleFormSets the form’s title.
shortenFormUrlStringConverts a long URL for a form to a short URL.
submitGradesFormSubmits grades for the given FormResponses.

Class FormResponse

メソッド名返り値簡単な説明
getEditResponseUrlStringGenerates a URL that can be used to edit a response that has already been submitted.
getGradableItemResponsesItemResponse[]Gets all item responses contained in a form response, in the same order that the items appear in the form.
getGradableResponseForItemItemResponseGets the item response contained in a form response for a given item.
getIdStringGets the ID of the form response.
getItemResponsesItemResponse[]Gets all item responses contained in a form response, in the same order that the items appear in the form.
getRespondentEmailStringGets the email address of the person who submitted a response, if the Form.setCollectEmail(collect) setting is enabled.
getResponseForItemItemResponseGets the item response contained in this form response for a given item.
getTimestampDateGets the timestamp for a form response submission.
submitFormResponseSubmits the response.
toPrefilledUrlStringGenerates a URL for the form in which the answers are pre-filled based on the answers in this form response.
withItemGradeFormResponseAdds the given item response’s grades to a form response.
withItemResponseFormResponseAdds the given item response to a form response.

Class GridItem

メソッド名返り値簡単な説明
clearValidationGridItemRemoves any data validation for this grid item.
createResponseItemResponseCreates a new ItemResponse for this grid item.
duplicateGridItemCreates a copy of this item and appends it to the end of the form.
getColumnsString[]Gets the values for every column in the grid.
getHelpTextStringGets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
getIdIntegerGets the item’s unique identifier.
getIndexIntegerGets the index of the item among all the items in the form.
getRowsString[]Gets the values for every row in the grid.
getTitleStringGets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
getTypeItemTypeGets the item’s type, represented as an ItemType.
isRequiredBooleanDetermines whether the respondent must answer the question.
setColumnsGridItemSets the columns of the grid based on an array of values.
setHelpTextGridItemSets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
setRequiredGridItemSets whether the respondent must answer the question.
setRowsGridItemSets the rows of the grid based on an array of values.
setTitleGridItemSets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
setValidationGridItemSets the data validation for this grid item.

Class GridValidation

Class GridValidationBuilder

メソッド名返り値簡単な説明
requireLimitOneResponsePerColumnGridValidationBuilderRequires limit of one response per column for a grid item.

Class ImageItem

メソッド名返り値簡単な説明
duplicateImageItemCreates a copy of this item and appends it to the end of the form.
getAlignmentAlignmentGets the image’s horizontal alignment.
getHelpTextStringGets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
getIdIntegerGets the item’s unique identifier.
getImageBlobGets the image that is currently assigned to the item.
getIndexIntegerGets the index of the item among all the items in the form.
getTitleStringGets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
getTypeItemTypeGets the item’s type, represented as an ItemType.
getWidthIntegerGets the image’s width in pixels.
setAlignmentImageItemSets the image’s horizontal alignment.
setHelpTextImageItemSets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
setImageImageItemSets the image itself.
setTitleImageItemSets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
setWidthImageItemSets the image’s width in pixels.

Class ItemResponse

メソッド名返り値簡単な説明
getFeedbackObjectGets the feedback that was given for the respondent’s submitted answer.
getItemItemGets the question item that this response answers.
getResponseObjectGets the answer that the respondent submitted.
getScoreObjectGets the score for the respondent’s submitted answer.
setFeedbackItemResponseSets the feedback that should be displayed for the respondent’s submitted answer.
setScoreItemResponseSets the score for the respondent’s submitted answer.

Class ListItem

メソッド名返り値簡単な説明
createChoiceChoiceCreates a new choice.
createResponseItemResponseCreates a new ItemResponse for this list item.
duplicateListItemCreates a copy of this item and appends it to the end of the form.
getChoicesChoice[]Gets all choices for an item.
getFeedbackForCorrectQuizFeedbackReturns the feedback that is shown to respondents when they respond correctly to a question.
getFeedbackForIncorrectQuizFeedbackReturns the feedback that is shown to respondents when they respond incorrectly to a question.
getHelpTextStringGets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
getIdIntegerGets the item’s unique identifier.
getIndexIntegerGets the index of the item among all the items in the form.
getPointsIntegerReturns the point value of a gradeable item.
getTitleStringGets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
getTypeItemTypeGets the item’s type, represented as an ItemType.
isRequiredBooleanDetermines whether the respondent must answer the question.
setChoiceValuesListItemSets the choices for an item from an array of strings.
setChoicesListItemSets an array of choices for an item.
setFeedbackForCorrectListItemSets the feedback to be shown to respondents when they respond correctly to a question.
setFeedbackForIncorrectListItemSets the feedback to be shown to respondents when they respond incorrectly to a question.
setHelpTextListItemSets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
setPointsListItemSets the number of points a gradeable item is worth.
setRequiredListItemSets whether the respondent must answer the question.
setTitleListItemSets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).

Class MultipleChoiceItem

メソッド名返り値簡単な説明
createChoiceChoiceCreates a new choice.
createResponseItemResponseCreates a new ItemResponse for this multiple-choice item.
duplicateMultipleChoiceItemCreates a copy of this item and appends it to the end of the form.
getChoicesChoice[]Gets all choices for an item.
getFeedbackForCorrectQuizFeedbackReturns the feedback that is shown to respondents when they respond correctly to a question.
getFeedbackForIncorrectQuizFeedbackReturns the feedback that is shown to respondents when they respond incorrectly to a question.
getHelpTextStringGets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
getIdIntegerGets the item’s unique identifier.
getIndexIntegerGets the index of the item among all the items in the form.
getPointsIntegerReturns the point value of a gradeable item.
getTitleStringGets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
getTypeItemTypeGets the item’s type, represented as an ItemType.
hasOtherOptionBooleanDetermines whether the item has an “other” option.
isRequiredBooleanDetermines whether the respondent must answer the question.
setChoiceValuesMultipleChoiceItemSets the choices for an item from an array of strings.
setChoicesMultipleChoiceItemSets an array of choices for an item.
setFeedbackForCorrectMultipleChoiceItemSets the feedback to be shown to respondents when they respond correctly to a question.
setFeedbackForIncorrectMultipleChoiceItemSets the feedback to be shown to respondents when they respond incorrectly to a question.
setHelpTextMultipleChoiceItemSets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
setPointsMultipleChoiceItemSets the number of points a gradeable item is worth.
setRequiredMultipleChoiceItemSets whether the respondent must answer the question.
setTitleMultipleChoiceItemSets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
showOtherOptionMultipleChoiceItemSets whether the item has an “other” option.

Class PageBreakItem

メソッド名返り値簡単な説明
duplicatePageBreakItemCreates a copy of this item and appends it to the end of the form.
getGoToPagePageBreakItemGets the PageBreakItem that the form will jump to after completing the page before this page break (that is, upon reaching this page break by normal linear progression through the form).
getHelpTextStringGets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
getIdIntegerGets the item’s unique identifier.
getIndexIntegerGets the index of the item among all the items in the form.
getPageNavigationTypePageNavigationTypeGets the type of page navigation that occurs after completing the page before this page break (that is, upon reaching this page break by normal linear progression through the form).
getTitleStringGets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
getTypeItemTypeGets the item’s type, represented as an ItemType.
setGoToPagePageBreakItemSets the page to jump to after completing the page before this page break (that is, upon reaching this page break by normal linear progression through the form).
setHelpTextPageBreakItemSets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
setTitlePageBreakItemSets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).

Class ParagraphTextItem

メソッド名返り値簡単な説明
clearValidationParagraphTextItemRemoves any data validation for this paragraph text item.
createResponseItemResponseCreates a new ItemResponse for this paragraph text item.
duplicateParagraphTextItemCreates a copy of this item and appends it to the end of the form.
getGeneralFeedbackQuizFeedbackReturns the feedback that is shown to respondents when they respond to a gradeable question.
getHelpTextStringGets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
getIdIntegerGets the item’s unique identifier.
getIndexIntegerGets the index of the item among all the items in the form.
getPointsIntegerReturns the point value of a gradeable item.
getTitleStringGets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
getTypeItemTypeGets the item’s type, represented as an ItemType.
isRequiredBooleanDetermines whether the respondent must answer the question.
setGeneralFeedbackParagraphTextItemSets the feedback to be shown to respondents when they respond to a gradeable question that doesn’t have a correct or incorrect answer (ie questions that require manual grading).
setHelpTextParagraphTextItemSets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
setPointsParagraphTextItemSets the number of points a gradeable item is worth.
setRequiredParagraphTextItemSets whether the respondent must answer the question.
setTitleParagraphTextItemSets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
setValidationParagraphTextItemSets the data validation for this paragraph text item.

Class ParagraphTextValidation

Class ParagraphTextValidationBuilder

メソッド名返り値簡単な説明
requireTextContainsPatternParagraphTextValidationBuilderRequires response to contain pattern.
requireTextDoesNotContainPatternParagraphTextValidationBuilderRequires response to not contain pattern.
requireTextDoesNotMatchPatternParagraphTextValidationBuilderRequires response to not match pattern.
requireTextLengthGreaterThanOrEqualToParagraphTextValidationBuilderRequires response length to be greater than or equal to value.
requireTextLengthLessThanOrEqualToParagraphTextValidationBuilderRequires response length to be less than value.
requireTextMatchesPatternParagraphTextValidationBuilderRequires response to match pattern.

Class QuizFeedback

メソッド名返り値簡単な説明
getLinkUrlsString[]Gets a list of the URLs associated with the Feedback.
getTextStringGets the Feedback’s display text.

Class QuizFeedbackBuilder

メソッド名返り値簡単な説明
addLinkQuizFeedbackBuilderAdds a link to the feedback’s supplemental material.
buildQuizFeedbackBuilds a Feedback of the corresponding type for this builder.
copyQuizFeedbackBuilderReturns a copy of this builder.
setTextQuizFeedbackBuilderSets the feedback text.

Class ScaleItem

メソッド名返り値簡単な説明
createResponseItemResponseCreates a new ItemResponse for this scale item.
duplicateScaleItemCreates a copy of this item and appends it to the end of the form.
getGeneralFeedbackQuizFeedbackReturns the feedback that is shown to respondents when they respond to a gradeable question.
getHelpTextStringGets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
getIdIntegerGets the item’s unique identifier.
getIndexIntegerGets the index of the item among all the items in the form.
getLeftLabelStringGets the label for the scale’s lower bound, if any.
getLowerBoundIntegerGets the scale’s lower bound.
getPointsIntegerReturns the point value of a gradeable item.
getRightLabelStringGets the label for the scale’s upper bound, if any.
getTitleStringGets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
getTypeItemTypeGets the item’s type, represented as an ItemType.
getUpperBoundIntegerGets the scale’s upper bound.
isRequiredBooleanDetermines whether the respondent must answer the question.
setBoundsScaleItemSets the scale’s lower and upper bounds.
setGeneralFeedbackScaleItemSets the feedback to be shown to respondents when they respond to a gradeable question that doesn’t have a correct or incorrect answer (ie questions that require manual grading).
setHelpTextScaleItemSets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
setLabelsScaleItemSets labels for the scale’s lower and upper bounds.
setPointsScaleItemSets the number of points a gradeable item is worth.
setRequiredScaleItemSets whether the respondent must answer the question.
setTitleScaleItemSets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).

Class SectionHeaderItem

メソッド名返り値簡単な説明
duplicateSectionHeaderItemCreates a copy of this item and appends it to the end of the form.
getHelpTextStringGets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
getIdIntegerGets the item’s unique identifier.
getIndexIntegerGets the index of the item among all the items in the form.
getTitleStringGets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
getTypeItemTypeGets the item’s type, represented as an ItemType.
setHelpTextSectionHeaderItemSets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
setTitleSectionHeaderItemSets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).

Class TextItem

メソッド名返り値簡単な説明
clearValidationTextItemRemoves any data validation for this text item.
createResponseItemResponseCreates a new ItemResponse for this text item.
duplicateTextItemCreates a copy of this item and appends it to the end of the form.
getGeneralFeedbackQuizFeedbackReturns the feedback that is shown to respondents when they respond to a gradeable question.
getHelpTextStringGets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
getIdIntegerGets the item’s unique identifier.
getIndexIntegerGets the index of the item among all the items in the form.
getPointsIntegerReturns the point value of a gradeable item.
getTitleStringGets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
getTypeItemTypeGets the item’s type, represented as an ItemType.
isRequiredBooleanDetermines whether the respondent must answer the question.
setGeneralFeedbackTextItemSets the feedback to be shown to respondents when they respond to a gradeable question that doesn’t have a correct or incorrect answer (ie questions that require manual grading).
setHelpTextTextItemSets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
setPointsTextItemSets the number of points a gradeable item is worth.
setRequiredTextItemSets whether the respondent must answer the question.
setTitleTextItemSets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
setValidationTextItemSets the data validation for this text item.

Class TextValidation

Class TextValidationBuilder

メソッド名返り値簡単な説明
requireNumberTextValidationBuilderRequires text item to be a number.
requireNumberBetweenTextValidationBuilderRequires text item to be a number between start and end, inclusive.
requireNumberEqualToTextValidationBuilderRequires text item to be a number equal to value specified.
requireNumberGreaterThanTextValidationBuilderRequires text item to be a number greater than the value specified.
requireNumberGreaterThanOrEqualToTextValidationBuilderRequires text item to be a number greater than or equal to the value specified.
requireNumberLessThanTextValidationBuilderRequires text item to be a number less than the value specified.
requireNumberLessThanOrEqualToTextValidationBuilderRequires text item to be a number less than or equal to the value specified.
requireNumberNotBetweenTextValidationBuilderRequires text item to be a number not between start and end, inclusive.
requireNumberNotEqualToTextValidationBuilderRequires text item to be a number not equal to the value specified.
requireTextContainsPatternTextValidationBuilderRequires response to contain pattern.
requireTextDoesNotContainPatternTextValidationBuilderRequires response to not contain pattern.
requireTextDoesNotMatchPatternTextValidationBuilderRequires response to not match pattern.
requireTextIsEmailTextValidationBuilderRequires text item to be an email address.
requireTextIsUrlTextValidationBuilderRequires text item to be a URL.
requireTextLengthGreaterThanOrEqualToTextValidationBuilderRequires response length to be greater than or equal to value.
requireTextLengthLessThanOrEqualToTextValidationBuilderRequires response length to be less than value.
requireTextMatchesPatternTextValidationBuilderRequires response to match pattern.
requireWholeNumberTextValidationBuilderRequires text item to be a whole number.

Class TimeItem

メソッド名返り値簡単な説明
createResponseItemResponseCreates a new ItemResponse for this time item.
duplicateTimeItemCreates a copy of this item and appends it to the end of the form.
getGeneralFeedbackQuizFeedbackReturns the feedback that is shown to respondents when they respond to a gradeable question.
getHelpTextStringGets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
getIdIntegerGets the item’s unique identifier.
getIndexIntegerGets the index of the item among all the items in the form.
getPointsIntegerReturns the point value of a gradeable item.
getTitleStringGets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
getTypeItemTypeGets the item’s type, represented as an ItemType.
isRequiredBooleanDetermines whether the respondent must answer the question.
setGeneralFeedbackTimeItemSets the feedback to be shown to respondents when they respond to a gradeable question that doesn’t have a correct or incorrect answer (ie questions that require manual grading).
setHelpTextTimeItemSets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
setPointsTimeItemSets the number of points a gradeable item is worth.
setRequiredTimeItemSets whether the respondent must answer the question.
setTitleTimeItemSets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).

Class VideoItem

メソッド名返り値簡単な説明
duplicateVideoItemCreates a copy of this item and appends it to the end of the form.
getAlignmentAlignmentGets the video’s horizontal alignment.
getHelpTextStringGets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
getIdIntegerGets the item’s unique identifier.
getIndexIntegerGets the index of the item among all the items in the form.
getTitleStringGets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
getTypeItemTypeGets the item’s type, represented as an ItemType.
getWidthIntegerGets the video’s width in pixels.
setAlignmentVideoItemSets the video’s horizontal alignment.
setHelpTextVideoItemSets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
setTitleVideoItemSets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
setVideoUrlVideoItemSets the video itself from a given YouTube URL or YouTube video ID.
setWidthVideoItemSets the video’s width in pixels.

インターフェイス名一覧

Item

インターフェイス名一覧

Item

※クリックすると対象場所にジャンプします

インターフェイス一覧

Interface Item

asCheckboxGridItemCheckboxGridItemReturns the item as a checkbox grid item.
asCheckboxItemCheckboxItemReturns the item as a checkbox item.
asDateItemDateItemReturns the item as a date item.
asDateTimeItemDateTimeItemReturns the item as a date-time item.
asDurationItemDurationItemReturns the item as a duration item.
asGridItemGridItemReturns the item as a grid item.
asImageItemImageItemReturns the item as an image item.
asListItemListItemReturns the item as a list item.
asMultipleChoiceItemMultipleChoiceItemReturns the item as a multiple-choice item.
asPageBreakItemPageBreakItemReturns the item as a page-break item.
asParagraphTextItemParagraphTextItemReturns the item as a paragraph-text item.
asScaleItemScaleItemReturns the item as a scale item.
asSectionHeaderItemSectionHeaderItemReturns the item as a section-header item.
asTextItemTextItemReturns the item as a text item.
asTimeItemTimeItemReturns the item as a time item.
asVideoItemVideoItemReturns the item as a video item.
duplicateItemCreates a copy of this item and appends it to the end of the form.
getHelpTextStringGets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
getIdIntegerGets the item’s unique identifier.
getIndexIntegerGets the index of the item among all the items in the form.
getTitleStringGets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).
getTypeItemTypeGets the item’s type, represented as an ItemType.
setHelpTextItemSets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
setTitleItemSets the item’s title (sometimes called header text, in the case of a SectionHeaderItem).

列挙型名一覧

AlignmentDestinationTypeFeedbackType
ItemTypePageNavigationType

列挙型一覧

列挙型のメソッドを利用するときには、基本的には『FormApp.列挙型名.プロパティ名』の形で利用します。例えば、AlignmentのLEFTを設定したい場合は、『FormApp.Alignment.LEFT』という形で記述します。

Enum Alignment

画像の揃えを設定できます。

プロパティタイプ説明
LEFTEnum画像をフォームの左に揃える
CENTEREnum画像をフォームの中央に揃える
RIGHTEnum画像をフォームの右に揃える

Enum DestinationType

フォームデータの保存先を設定できます。保存先を設定しているかどうかに関わらず、すべてのフォームデータは回答のコピーとしてフォームファイルに保存されています。保存先を設定するためにはsetDestinationメソッドと『FormApp.DestinationType.プロパティ名』を併用することで設定ができます。

プロパティタイプ説明
SPREADSHEETEnum保存先のスプレッドシートを設定

Enum FeedbackType

フィードバックの表示方法を設定できます。

プロパティタイプ説明
CORRECTEnumFeedback that is automatically displayed to respondents for a question answered correctly. Correct feedback can only be attached to a question type that supports autograding (e.g. radio, checkbox, select)
INCORRECTEnumFeedback that is automatically displayed to respondents for a question answered incorrectly. Incorrect feedback can only be attached to a question type that supports autograding (e.g. radio, checkbox, select)
GENERALEnumFeedback that is automatically displayed to respondents when they submit their response. General feedback can only be attached to question types that do not support auto-grading, but are gradeable (ie everything but grid)

Enum ItemType

項目のタイプを設定できます。各項目のgetTypeメソッドで取得できるタイプはこちらと同じものになりますので、項目タイプによって処理を分けたい場合などでは『FormApp.ItemType.プロパティ名』で条件を設定します。

CHECKBOXEnumA question item that allows the respondent to select one or more checkboxes, as well as an optional “other” field.
CHECKBOX_GRIDEnumA 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.
DATEEnumA question item that allows the respondent to indicate a date.
DATETIMEEnumA question item that allows the respondent to indicate a date and time.
DURATIONEnumA question item that allows the respondent to indicate a length of time.
GRIDEnumA 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.
IMAGEEnumA layout item that displays an image.
LISTEnumA question item that allows the respondent to select one choice from a drop-down list.
MULTIPLE_CHOICEEnumA question item that allows the respondent to select one choice from a list of radio buttons or an optional “other” field.
PAGE_BREAKEnumA layout item that marks the start of a page.
PARAGRAPH_TEXT Enum A question item that allows the respondent to enter a block of text.
SCALEEnumA question item that allows the respondent to choose one option from a numbered sequence of radio buttons.
SECTION_HEADEREnumA layout item that visually indicates the start of a section.
TEXTEnum A question item that allows the respondent to enter a single line of text.
TIMEEnumA question item that allows the respondent to indicate a time of day.
VIDEOEnumA layout item that displays a YouTube video.

ページナビゲーションタイプを設定します。
ページナビゲーションは項目の選択肢にページナビゲーションが設定されていて、回答者がその選択肢を選んだときに動作します。選択肢の中から複数の選択をして、それぞれの選択肢にページナビゲーションが設定されている場合は、最後に選択肢たページナビゲーションのみ実行されます。
また、最後のページに設定されているページナビゲーションは実行されません。
ページナビゲーションを設定された選択肢は、設定されていない選択肢と一緒に一つの項目に設定することはできません。

プロパティタイプ説明
CONTINUEEnum現在のページが終わったら、次のページに進みます。通常はデフォルト設定ですが、ページナビゲーションを設定する場合は明示的に設定する必要があります。
GO_TO_PAGEEnum現在のページが終わったら、特定のページに進みます。
RESTARTEnum現在のページが終わったら、すでに入力されたデータはそのままの状態でフォームの最初に戻ります。
SUBMITEnum現在のページが終わったら、フォームを送信します。
templateLogo_FormApp

この記事が気に入ったら
いいね または フォローしてね!

よかったらシェアしてね!
URLをコピーする
URLをコピーしました!
  • URLをコピーしました!

この記事を書いた人

初心者でもわかるGoogle Apps Script活用のススメの管理人。
業務でラクをするという邪な目的のためにプログラムを独学で勉強し始め、初心者向けのGoogle Apps Scriptの使い方サイトを運営するに至る。
ラクをするためにはどんな苦労も厭わないという考えから、手っ取り早くスキルアップするためにCrowdWorksやLancersなどで仕事を受注し始め、過去にはTopClass PRO Crowd workerに認定された経験を持つ。
現在では、業務効率化システムの開発を行う会社の代表を務める。

コメント

コメントする

目次
トップへ
目次
閉じる