Googleフォームで使えるGASのコード一覧
本記事では、Google Apps ScriptでGoogleフォームに対して使うことができるFormAppという処理の一覧表を用意しました。
Google公式ドキュメントは英語表記しかありませんので、分かりづらいため、みなさんがそこで挫折しないように日本語出ないようが把握できるようにしています。
まだすべてのメソッドで日本語での使い方が解説できているわけではありませんが、最終的にはすべての使い方を日本語で解説するページを用意していきます。
日本語化されている記事の見分け方は、簡単な説明列で日本語が記載されているものについては日本語記事が用意できています。
メソッド名をクリックすることで対象の記事にリンクしています。
日本語の記事が出来上がっていないメソッドについてはGoogleから提供されている公式ドキュメント(英語)へのリンクとなっています。
FormAppの概要
FormAppとは、Google Apps ScriptでGoogleフォームに対する操作を行うコードですが、FormAppに用意されているメソッドでは、次のような操作を行うことができます。
- フォームファイルの作成
- フォーム質問の作成
- 保存先のスプレッドシートの設定
- 送信済みの回答を取得
クラス名一覧
※クリックすると対象場所にジャンプします
クラス別メソッド名一覧
Class CheckboxGridItem
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
clearValidation | CheckboxGridItem | Removes any data validation for this grid item. |
createResponse | ItemResponse | Creates a new ItemResponse for this checkbox grid item. |
duplicate | CheckboxGridItem | Creates a copy of this item and appends it to the end of the form. |
getColumns | String[] | Gets the values for every column in the grid. |
getHelpText | String | Gets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
getId | Integer | Gets the item’s unique identifier. |
getIndex | Integer | Gets the index of the item among all the items in the form. |
getRows | String[] | Gets the values for every row in the grid. |
getTitle | String | Gets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
getType | ItemType | Gets the item’s type, represented as an ItemType. |
isRequired | Boolean | Determines whether the respondent must answer the question. |
setColumns | CheckboxGridItem | Sets the columns of the grid based on an array of values. |
setHelpText | CheckboxGridItem | Sets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
setRequired | CheckboxGridItem | Sets whether the respondent must answer the question. |
setRows | CheckboxGridItem | Sets the rows of the grid based on an array of values. |
setTitle | CheckboxGridItem | Sets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
setValidation | CheckboxGridItem | Sets the data validation for this checkbox grid item. |
Class CheckboxGridValidation
Class CheckboxGridValidationBuilder
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
requireLimitOneResponsePerColumn | CheckboxGridValidationBuilder | Requires limit of one response per column for a grid item. |
Class CheckboxItem
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
clearValidation | CheckboxItem | Removes any data validation for this checkbox item. |
createChoice | Choice | Creates a new choice. |
createResponse | ItemResponse | Creates a new ItemResponse for this checkbox item. |
duplicate | CheckboxItem | Creates a copy of this item and appends it to the end of the form. |
getChoices | Choice[] | Gets all choices for an item. |
getFeedbackForCorrect | QuizFeedback | Returns the feedback that is shown to respondents when they respond correctly to a question. |
getHelpText | QuizFeedback | Gets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
getId | String | Gets the item’s unique identifier. |
getIndex | Integer | Gets the index of the item among all the items in the form. |
getPoints | Integer | Returns the point value of a gradeable item. |
getTitle | Integer | Gets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
getType | String | Gets the item’s type, represented as an ItemType. |
hasOtherOption | ItemType | Determines whether the item has an “other” option. |
isRequired | Boolean | Determines whether the respondent must answer the question. |
setChoiceValues | Boolean | Sets the choices for an item from an array of strings. |
setChoices | CheckboxItem | Sets an array of choices for an item. |
setFeedbackForCorrect | CheckboxItem | Sets the feedback to be shown to respondents when they respond correctly to a question. |
setFeedbackForIncorrect | CheckboxItem | Sets the feedback to be shown to respondents when they respond incorrectly to a question. |
setHelpText | CheckboxItem | Sets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
setPoints | CheckboxItem | Sets the number of points a gradeable item is worth. |
setRequired | CheckboxItem | Sets whether the respondent must answer the question. |
setTitle | CheckboxItem | Sets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
setValidation | CheckboxItem | Sets the data validation for this checkbox item. |
showOtherOption | CheckboxItem | Sets whether the item has an “other” option. |
Class CheckboxValidation
Class CheckboxValidationBuilder
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
requireSelectAtLeast | CheckboxValidationBuilder | Require at least this many choices to be selected. |
requireSelectAtMost | CheckboxValidationBuilder | Require at most this many choices to be selected. |
requireSelectExactly | CheckboxValidationBuilder | Require exactly this many choices to be selected. |
Class Choice
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
getGotoPage | PageBreakItem | Gets the PageBreakItem set as a GO_TO_PAGE destination if the responder selects this choice and completes the current page. |
getPageNavigationType | PageNavigationType | Gets the PageNavigationType that occurs if the responder selects this choice and completes the current page. |
getValue | String | Gets the choice’s value, which respondents see as a label when viewing the form. |
isCorrectAnswer | Boolean | Gets whether the choice is a correct answer for the question. |
Class DateItem
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
createResponse | ItemResponse | Creates a new ItemResponse for this date item. |
duplicate | DateItem | Creates a copy of this item and appends it to the end of the form. |
getGeneralFeedback | QuizFeedback | Returns the feedback that is shown to respondents when they respond to a gradeable question. |
getHelpText | String | Gets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
getId | Integer | Gets the item’s unique identifier. |
getIndex | Integer | Gets the index of the item among all the items in the form. |
getPoints | Integer | Returns the point value of a gradeable item. |
getTitle | String | Gets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
getType | ItemType | Gets the item’s type, represented as an ItemType. |
includesYear | Boolean | Determines whether the date item includes a year option. |
isRequired | Boolean | Determines whether the respondent must answer the question. |
setGeneralFeedback | DateItem | Sets 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). |
setHelpText | DateItem | Sets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
setIncludesYear | DateItem | Sets whether the date item includes a year setting. |
setPoints | DateItem | Sets the number of points a gradeable item is worth. |
setRequired | DateItem | Sets whether the respondent must answer the question. |
setTitle | DateItem | Sets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
Class DateTimeItem
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
createResponse | ItemResponse | Creates a new ItemResponse for this date-time item. |
duplicate | DateTimeItem | Creates a copy of this item and appends it to the end of the form. |
getGeneralFeedback | QuizFeedback | Returns the feedback that is shown to respondents when they respond to a gradeable question. |
getHelpText | String | Gets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
getId | Integer | Gets the item’s unique identifier. |
getIndex | Integer | Gets the index of the item among all the items in the form. |
getPoints | Integer | Returns the point value of a gradeable item. |
getTitle | String | Gets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
getType | ItemType | Gets the item’s type, represented as an ItemType. |
includesYear | Boolean | Determines whether the date item includes a year option. |
isRequired | Boolean | Determines whether the respondent must answer the question. |
setGeneralFeedback | DateTimeItem | Sets 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). |
setHelpText | DateTimeItem | Sets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
setIncludesYear | DateTimeItem | Sets whether the date item includes a year setting. |
setPoints | DateTimeItem | Sets the number of points a gradeable item is worth. |
setRequired | DateTimeItem | Sets whether the respondent must answer the question. |
setTitle | DateTimeItem | Sets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
Class DurationItem
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
createResponse | ItemResponse | Creates a new ItemResponse for this date item. |
duplicate | DurationItem | Creates a copy of this item and appends it to the end of the form. |
getGeneralFeedback | QuizFeedback | Returns the feedback that is shown to respondents when they respond to a gradeable question. |
getHelpText | String | Gets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
getId | Integer | Gets the item’s unique identifier. |
getIndex | Integer | Gets the index of the item among all the items in the form. |
getPoints | Integer | Returns the point value of a gradeable item. |
getTitle | String | Gets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
getType | ItemType | Gets the item’s type, represented as an ItemType. |
isRequired | Boolean | Determines whether the respondent must answer the question. |
setGeneralFeedback | DurationItem | Sets 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). |
setHelpText | DurationItem | Sets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
setPoints | DurationItem | Sets the number of points a gradeable item is worth. |
setRequired | DurationItem | Sets whether the respondent must answer the question. |
setTitle | DurationItem | Sets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
Class Form
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
addCheckboxGridItem | CheckboxGridItem | 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. |
addCheckboxItem | CheckboxItem | Appends a new question item that allows the respondent to select one or more checkboxes, as well as an optional “other” field. |
addDateItem | DateItem | Appends a new question item that allows the respondent to indicate a date. |
addDateTimeItem | DateTimeItem | Appends a new question item that allows the respondent to indicate a date and time. |
addDurationItem | DurationItem | Appends a new question item that allows the respondent to indicate a length of time. |
addEditor | Form | Adds the given user to the list of editors for the Form. |
addEditors | Form | Adds the given array of users to the list of editors for the Form. |
addGridItem | GridItem | 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. |
addImageItem | ImageItem | Appends a new layout item that displays an image. |
addListItem | ListItem | Appends a new question item that allows the respondent to select one choice from a drop-down list. |
addMultipleChoiceItem | MultipleChoiceItem | Appends a new question item that allows the respondent to select one choice from a list of radio buttons or an optional “other” field. |
addPageBreakItem | PageBreakItem | Appends a new layout item that marks the start of a page. |
addParagraphTextItem | ParagraphTextItem | Appends a new question item that allows the respondent to enter a block of text. |
addScaleItem | ScaleItem | Appends a new question item that allows the respondent to choose one option from a numbered sequence of radio buttons. |
addSectionHeaderItem | SectionHeaderItem | Appends a new layout item that visually indicates the start of a section. |
addTextItem | TextItem | Appends a new question item that allows the respondent to enter a single line of text. |
addTimeItem | TimeItem | Appends a new question item that allows the respondent to indicate a time of day. |
addVideoItem | VideoItem | Appends a new layout item that displays a video. |
canEditResponse | Boolean | Determines whether the form displays a link to edit a response after submitting it. |
collectsEmail | Boolean | Determines whether the form collects respondents’ email addresses. |
createResponse | FormResponse | Creates a new response to the form. |
deleteAllResponses | Form | Deletes all submitted responses from the form’s response store. |
deleteItem | void | Deletes the item at a given index among all the items in the form. |
deleteResponse | Form | Deletes a single response from the form’s response store. |
getConfirmationMessage | String | Gets the form’s confirmation message. |
getCustomClosedFormMessage | String | Gets 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. |
getDescription | String | Gets the form’s description. |
getDestinationId | String | Gets the ID of the form’s response destination. |
getDestinationType | DestinationType | Gets the type of the form’s response destination. |
getEditUrl | String | Gets the URL that can be used to access the form’s edit mode. |
getEditors | User[] | Gets the list of editors for this Form. |
getId | String | Gets the ID of the form. |
getItemById | Item | Gets the item with a given ID. |
getItems | Item[] | Gets an array of all items in the form. |
getPublishedUrl | String | Gets the URL that can be used to respond to the form. |
getResponse | FormResponse | Gets a single form response based on its response ID. |
getResponses | FormResponse[] | Gets an array of all of the form’s responses. |
getShuffleQuestions | Boolean | Determines whether the order of the questions on each page of the form is randomized. |
getSummaryUrl | String | Gets the URL that can be used to view a summary of the form’s responses. |
getTitle | String | Gets the form’s title. |
hasLimitOneResponsePerUser | Boolean | Determines whether the form allows only one response per respondent. |
hasProgressBar | Boolean | Determines whether the form displays a progress bar. |
hasRespondAgainLink | Boolean | Determines whether the form displays a link to submit another response after a respondent completes the form. |
isAcceptingResponses | Boolean | Determines whether the form is currently accepting responses. |
isPublishingSummary | Boolean | Determines whether the form displays a link to view a summary of responses after a respondent completes the form. |
isQuiz | Boolean | Determines whether the form is a quiz. |
moveItem | Item | Moves an item at a given index among all the items in the form to another given index. |
removeDestination | Form | Unlinks the form from its current response destination. |
removeEditor | Form | Removes the given user from the list of editors for the Form. |
requiresLogin | Boolean | Determines whether the form requires respondents to log in to an account in the same domain or a subdomain before responding. |
setAcceptingResponses | Form | Sets whether the form is currently accepting responses. |
setAllowResponseEdits | Form | Sets whether the form displays a link to edit a response after submitting it. |
setCollectEmail | Form | Sets whether the form collects respondents’ email addresses. |
setConfirmationMessage | Form | Sets the form’s confirmation message. |
setCustomClosedFormMessage | Form | Sets the message to display if the form is not accepting responses. |
setDescription | Form | Sets the form’s description. |
setDestination | Form | Sets the destination where form responses are saved. |
setIsQuiz | Form | Sets whether the form is a quiz. |
setLimitOneResponsePerUser | Form | Sets whether the form allows only one response per respondent. |
setProgressBar | Form | Sets whether the form has a progress bar. |
setPublishingSummary | Form | Sets whether the form displays a link to view a summary of responses after a respondent submits the form. |
setRequireLogin | Form | Sets whether the form requires respondents to log in to an account in the same domain or a subdomain before responding. |
setShowLinkToRespondAgain | Form | Sets whether the form displays a link to submit another response after a respondent completes the form. |
setShuffleQuestions | Form | Sets whether the order of the questions on each page of the form is randomized. |
setTitle | Form | Sets the form’s title. |
shortenFormUrl | String | Converts a long URL for a form to a short URL. |
submitGrades | Form | Submits grades for the given FormResponses. |
Class FormResponse
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
getEditResponseUrl | String | Generates a URL that can be used to edit a response that has already been submitted. |
getGradableItemResponses | ItemResponse[] | Gets all item responses contained in a form response, in the same order that the items appear in the form. |
getGradableResponseForItem | ItemResponse | Gets the item response contained in a form response for a given item. |
getId | String | Gets the ID of the form response. |
getItemResponses | ItemResponse[] | Gets all item responses contained in a form response, in the same order that the items appear in the form. |
getRespondentEmail | String | Gets the email address of the person who submitted a response, if the Form.setCollectEmail(collect) setting is enabled. |
getResponseForItem | ItemResponse | Gets the item response contained in this form response for a given item. |
getTimestamp | Date | Gets the timestamp for a form response submission. |
submit | FormResponse | Submits the response. |
toPrefilledUrl | String | Generates a URL for the form in which the answers are pre-filled based on the answers in this form response. |
withItemGrade | FormResponse | Adds the given item response’s grades to a form response. |
withItemResponse | FormResponse | Adds the given item response to a form response. |
Class GridItem
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
clearValidation | GridItem | Removes any data validation for this grid item. |
createResponse | ItemResponse | Creates a new ItemResponse for this grid item. |
duplicate | GridItem | Creates a copy of this item and appends it to the end of the form. |
getColumns | String[] | Gets the values for every column in the grid. |
getHelpText | String | Gets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
getId | Integer | Gets the item’s unique identifier. |
getIndex | Integer | Gets the index of the item among all the items in the form. |
getRows | String[] | Gets the values for every row in the grid. |
getTitle | String | Gets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
getType | ItemType | Gets the item’s type, represented as an ItemType. |
isRequired | Boolean | Determines whether the respondent must answer the question. |
setColumns | GridItem | Sets the columns of the grid based on an array of values. |
setHelpText | GridItem | Sets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
setRequired | GridItem | Sets whether the respondent must answer the question. |
setRows | GridItem | Sets the rows of the grid based on an array of values. |
setTitle | GridItem | Sets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
setValidation | GridItem | Sets the data validation for this grid item. |
Class GridValidation
Class GridValidationBuilder
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
requireLimitOneResponsePerColumn | GridValidationBuilder | Requires limit of one response per column for a grid item. |
Class ImageItem
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
duplicate | ImageItem | Creates a copy of this item and appends it to the end of the form. |
getAlignment | Alignment | Gets the image’s horizontal alignment. |
getHelpText | String | Gets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
getId | Integer | Gets the item’s unique identifier. |
getImage | Blob | Gets the image that is currently assigned to the item. |
getIndex | Integer | Gets the index of the item among all the items in the form. |
getTitle | String | Gets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
getType | ItemType | Gets the item’s type, represented as an ItemType. |
getWidth | Integer | Gets the image’s width in pixels. |
setAlignment | ImageItem | Sets the image’s horizontal alignment. |
setHelpText | ImageItem | Sets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
setImage | ImageItem | Sets the image itself. |
setTitle | ImageItem | Sets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
setWidth | ImageItem | Sets the image’s width in pixels. |
Class ItemResponse
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
getFeedback | Object | Gets the feedback that was given for the respondent’s submitted answer. |
getItem | Item | Gets the question item that this response answers. |
getResponse | Object | Gets the answer that the respondent submitted. |
getScore | Object | Gets the score for the respondent’s submitted answer. |
setFeedback | ItemResponse | Sets the feedback that should be displayed for the respondent’s submitted answer. |
setScore | ItemResponse | Sets the score for the respondent’s submitted answer. |
Class ListItem
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
createChoice | Choice | Creates a new choice. |
createResponse | ItemResponse | Creates a new ItemResponse for this list item. |
duplicate | ListItem | Creates a copy of this item and appends it to the end of the form. |
getChoices | Choice[] | Gets all choices for an item. |
getFeedbackForCorrect | QuizFeedback | Returns the feedback that is shown to respondents when they respond correctly to a question. |
getFeedbackForIncorrect | QuizFeedback | Returns the feedback that is shown to respondents when they respond incorrectly to a question. |
getHelpText | String | Gets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
getId | Integer | Gets the item’s unique identifier. |
getIndex | Integer | Gets the index of the item among all the items in the form. |
getPoints | Integer | Returns the point value of a gradeable item. |
getTitle | String | Gets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
getType | ItemType | Gets the item’s type, represented as an ItemType. |
isRequired | Boolean | Determines whether the respondent must answer the question. |
setChoiceValues | ListItem | Sets the choices for an item from an array of strings. |
setChoices | ListItem | Sets an array of choices for an item. |
setFeedbackForCorrect | ListItem | Sets the feedback to be shown to respondents when they respond correctly to a question. |
setFeedbackForIncorrect | ListItem | Sets the feedback to be shown to respondents when they respond incorrectly to a question. |
setHelpText | ListItem | Sets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
setPoints | ListItem | Sets the number of points a gradeable item is worth. |
setRequired | ListItem | Sets whether the respondent must answer the question. |
setTitle | ListItem | Sets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
Class MultipleChoiceItem
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
createChoice | Choice | Creates a new choice. |
createResponse | ItemResponse | Creates a new ItemResponse for this multiple-choice item. |
duplicate | MultipleChoiceItem | Creates a copy of this item and appends it to the end of the form. |
getChoices | Choice[] | Gets all choices for an item. |
getFeedbackForCorrect | QuizFeedback | Returns the feedback that is shown to respondents when they respond correctly to a question. |
getFeedbackForIncorrect | QuizFeedback | Returns the feedback that is shown to respondents when they respond incorrectly to a question. |
getHelpText | String | Gets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
getId | Integer | Gets the item’s unique identifier. |
getIndex | Integer | Gets the index of the item among all the items in the form. |
getPoints | Integer | Returns the point value of a gradeable item. |
getTitle | String | Gets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
getType | ItemType | Gets the item’s type, represented as an ItemType. |
hasOtherOption | Boolean | Determines whether the item has an “other” option. |
isRequired | Boolean | Determines whether the respondent must answer the question. |
setChoiceValues | MultipleChoiceItem | Sets the choices for an item from an array of strings. |
setChoices | MultipleChoiceItem | Sets an array of choices for an item. |
setFeedbackForCorrect | MultipleChoiceItem | Sets the feedback to be shown to respondents when they respond correctly to a question. |
setFeedbackForIncorrect | MultipleChoiceItem | Sets the feedback to be shown to respondents when they respond incorrectly to a question. |
setHelpText | MultipleChoiceItem | Sets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
setPoints | MultipleChoiceItem | Sets the number of points a gradeable item is worth. |
setRequired | MultipleChoiceItem | Sets whether the respondent must answer the question. |
setTitle | MultipleChoiceItem | Sets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
showOtherOption | MultipleChoiceItem | Sets whether the item has an “other” option. |
Class PageBreakItem
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
duplicate | PageBreakItem | Creates a copy of this item and appends it to the end of the form. |
getGoToPage | PageBreakItem | Gets 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). |
getHelpText | String | Gets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
getId | Integer | Gets the item’s unique identifier. |
getIndex | Integer | Gets the index of the item among all the items in the form. |
getPageNavigationType | PageNavigationType | Gets 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). |
getTitle | String | Gets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
getType | ItemType | Gets the item’s type, represented as an ItemType. |
setGoToPage | PageBreakItem | Sets 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). |
setHelpText | PageBreakItem | Sets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
setTitle | PageBreakItem | Sets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
Class ParagraphTextItem
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
clearValidation | ParagraphTextItem | Removes any data validation for this paragraph text item. |
createResponse | ItemResponse | Creates a new ItemResponse for this paragraph text item. |
duplicate | ParagraphTextItem | Creates a copy of this item and appends it to the end of the form. |
getGeneralFeedback | QuizFeedback | Returns the feedback that is shown to respondents when they respond to a gradeable question. |
getHelpText | String | Gets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
getId | Integer | Gets the item’s unique identifier. |
getIndex | Integer | Gets the index of the item among all the items in the form. |
getPoints | Integer | Returns the point value of a gradeable item. |
getTitle | String | Gets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
getType | ItemType | Gets the item’s type, represented as an ItemType. |
isRequired | Boolean | Determines whether the respondent must answer the question. |
setGeneralFeedback | ParagraphTextItem | Sets 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). |
setHelpText | ParagraphTextItem | Sets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
setPoints | ParagraphTextItem | Sets the number of points a gradeable item is worth. |
setRequired | ParagraphTextItem | Sets whether the respondent must answer the question. |
setTitle | ParagraphTextItem | Sets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
setValidation | ParagraphTextItem | Sets the data validation for this paragraph text item. |
Class ParagraphTextValidation
Class ParagraphTextValidationBuilder
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
requireTextContainsPattern | ParagraphTextValidationBuilder | Requires response to contain pattern. |
requireTextDoesNotContainPattern | ParagraphTextValidationBuilder | Requires response to not contain pattern. |
requireTextDoesNotMatchPattern | ParagraphTextValidationBuilder | Requires response to not match pattern. |
requireTextLengthGreaterThanOrEqualTo | ParagraphTextValidationBuilder | Requires response length to be greater than or equal to value. |
requireTextLengthLessThanOrEqualTo | ParagraphTextValidationBuilder | Requires response length to be less than value. |
requireTextMatchesPattern | ParagraphTextValidationBuilder | Requires response to match pattern. |
Class QuizFeedback
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
getLinkUrls | String[] | Gets a list of the URLs associated with the Feedback. |
getText | String | Gets the Feedback’s display text. |
Class QuizFeedbackBuilder
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
addLink | QuizFeedbackBuilder | Adds a link to the feedback’s supplemental material. |
build | QuizFeedback | Builds a Feedback of the corresponding type for this builder. |
copy | QuizFeedbackBuilder | Returns a copy of this builder. |
setText | QuizFeedbackBuilder | Sets the feedback text. |
Class ScaleItem
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
createResponse | ItemResponse | Creates a new ItemResponse for this scale item. |
duplicate | ScaleItem | Creates a copy of this item and appends it to the end of the form. |
getGeneralFeedback | QuizFeedback | Returns the feedback that is shown to respondents when they respond to a gradeable question. |
getHelpText | String | Gets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
getId | Integer | Gets the item’s unique identifier. |
getIndex | Integer | Gets the index of the item among all the items in the form. |
getLeftLabel | String | Gets the label for the scale’s lower bound, if any. |
getLowerBound | Integer | Gets the scale’s lower bound. |
getPoints | Integer | Returns the point value of a gradeable item. |
getRightLabel | String | Gets the label for the scale’s upper bound, if any. |
getTitle | String | Gets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
getType | ItemType | Gets the item’s type, represented as an ItemType. |
getUpperBound | Integer | Gets the scale’s upper bound. |
isRequired | Boolean | Determines whether the respondent must answer the question. |
setBounds | ScaleItem | Sets the scale’s lower and upper bounds. |
setGeneralFeedback | ScaleItem | Sets 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). |
setHelpText | ScaleItem | Sets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
setLabels | ScaleItem | Sets labels for the scale’s lower and upper bounds. |
setPoints | ScaleItem | Sets the number of points a gradeable item is worth. |
setRequired | ScaleItem | Sets whether the respondent must answer the question. |
setTitle | ScaleItem | Sets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
Class SectionHeaderItem
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
duplicate | SectionHeaderItem | Creates a copy of this item and appends it to the end of the form. |
getHelpText | String | Gets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
getId | Integer | Gets the item’s unique identifier. |
getIndex | Integer | Gets the index of the item among all the items in the form. |
getTitle | String | Gets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
getType | ItemType | Gets the item’s type, represented as an ItemType. |
setHelpText | SectionHeaderItem | Sets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
setTitle | SectionHeaderItem | Sets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
Class TextItem
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
clearValidation | TextItem | Removes any data validation for this text item. |
createResponse | ItemResponse | Creates a new ItemResponse for this text item. |
duplicate | TextItem | Creates a copy of this item and appends it to the end of the form. |
getGeneralFeedback | QuizFeedback | Returns the feedback that is shown to respondents when they respond to a gradeable question. |
getHelpText | String | Gets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
getId | Integer | Gets the item’s unique identifier. |
getIndex | Integer | Gets the index of the item among all the items in the form. |
getPoints | Integer | Returns the point value of a gradeable item. |
getTitle | String | Gets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
getType | ItemType | Gets the item’s type, represented as an ItemType. |
isRequired | Boolean | Determines whether the respondent must answer the question. |
setGeneralFeedback | TextItem | Sets 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). |
setHelpText | TextItem | Sets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
setPoints | TextItem | Sets the number of points a gradeable item is worth. |
setRequired | TextItem | Sets whether the respondent must answer the question. |
setTitle | TextItem | Sets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
setValidation | TextItem | Sets the data validation for this text item. |
Class TextValidation
Class TextValidationBuilder
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
requireNumber | TextValidationBuilder | Requires text item to be a number. |
requireNumberBetween | TextValidationBuilder | Requires text item to be a number between start and end, inclusive. |
requireNumberEqualTo | TextValidationBuilder | Requires text item to be a number equal to value specified. |
requireNumberGreaterThan | TextValidationBuilder | Requires text item to be a number greater than the value specified. |
requireNumberGreaterThanOrEqualTo | TextValidationBuilder | Requires text item to be a number greater than or equal to the value specified. |
requireNumberLessThan | TextValidationBuilder | Requires text item to be a number less than the value specified. |
requireNumberLessThanOrEqualTo | TextValidationBuilder | Requires text item to be a number less than or equal to the value specified. |
requireNumberNotBetween | TextValidationBuilder | Requires text item to be a number not between start and end, inclusive. |
requireNumberNotEqualTo | TextValidationBuilder | Requires text item to be a number not equal to the value specified. |
requireTextContainsPattern | TextValidationBuilder | Requires response to contain pattern. |
requireTextDoesNotContainPattern | TextValidationBuilder | Requires response to not contain pattern. |
requireTextDoesNotMatchPattern | TextValidationBuilder | Requires response to not match pattern. |
requireTextIsEmail | TextValidationBuilder | Requires text item to be an email address. |
requireTextIsUrl | TextValidationBuilder | Requires text item to be a URL. |
requireTextLengthGreaterThanOrEqualTo | TextValidationBuilder | Requires response length to be greater than or equal to value. |
requireTextLengthLessThanOrEqualTo | TextValidationBuilder | Requires response length to be less than value. |
requireTextMatchesPattern | TextValidationBuilder | Requires response to match pattern. |
requireWholeNumber | TextValidationBuilder | Requires text item to be a whole number. |
Class TimeItem
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
createResponse | ItemResponse | Creates a new ItemResponse for this time item. |
duplicate | TimeItem | Creates a copy of this item and appends it to the end of the form. |
getGeneralFeedback | QuizFeedback | Returns the feedback that is shown to respondents when they respond to a gradeable question. |
getHelpText | String | Gets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
getId | Integer | Gets the item’s unique identifier. |
getIndex | Integer | Gets the index of the item among all the items in the form. |
getPoints | Integer | Returns the point value of a gradeable item. |
getTitle | String | Gets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
getType | ItemType | Gets the item’s type, represented as an ItemType. |
isRequired | Boolean | Determines whether the respondent must answer the question. |
setGeneralFeedback | TimeItem | Sets 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). |
setHelpText | TimeItem | Sets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
setPoints | TimeItem | Sets the number of points a gradeable item is worth. |
setRequired | TimeItem | Sets whether the respondent must answer the question. |
setTitle | TimeItem | Sets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
Class VideoItem
メソッド名 | 返り値 | 簡単な説明 |
---|---|---|
duplicate | VideoItem | Creates a copy of this item and appends it to the end of the form. |
getAlignment | Alignment | Gets the video’s horizontal alignment. |
getHelpText | String | Gets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
getId | Integer | Gets the item’s unique identifier. |
getIndex | Integer | Gets the index of the item among all the items in the form. |
getTitle | String | Gets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
getType | ItemType | Gets the item’s type, represented as an ItemType. |
getWidth | Integer | Gets the video’s width in pixels. |
setAlignment | VideoItem | Sets the video’s horizontal alignment. |
setHelpText | VideoItem | Sets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
setTitle | VideoItem | Sets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
setVideoUrl | VideoItem | Sets the video itself from a given YouTube URL or YouTube video ID. |
setWidth | VideoItem | Sets the video’s width in pixels. |
インターフェイス名一覧
インターフェイス名一覧
Item |
※クリックすると対象場所にジャンプします
インターフェイス一覧
Interface Item
asCheckboxGridItem | CheckboxGridItem | Returns the item as a checkbox grid item. |
asCheckboxItem | CheckboxItem | Returns the item as a checkbox item. |
asDateItem | DateItem | Returns the item as a date item. |
asDateTimeItem | DateTimeItem | Returns the item as a date-time item. |
asDurationItem | DurationItem | Returns the item as a duration item. |
asGridItem | GridItem | Returns the item as a grid item. |
asImageItem | ImageItem | Returns the item as an image item. |
asListItem | ListItem | Returns the item as a list item. |
asMultipleChoiceItem | MultipleChoiceItem | Returns the item as a multiple-choice item. |
asPageBreakItem | PageBreakItem | Returns the item as a page-break item. |
asParagraphTextItem | ParagraphTextItem | Returns the item as a paragraph-text item. |
asScaleItem | ScaleItem | Returns the item as a scale item. |
asSectionHeaderItem | SectionHeaderItem | Returns the item as a section-header item. |
asTextItem | TextItem | Returns the item as a text item. |
asTimeItem | TimeItem | Returns the item as a time item. |
asVideoItem | VideoItem | Returns the item as a video item. |
duplicate | Item | Creates a copy of this item and appends it to the end of the form. |
getHelpText | String | Gets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
getId | Integer | Gets the item’s unique identifier. |
getIndex | Integer | Gets the index of the item among all the items in the form. |
getTitle | String | Gets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
getType | ItemType | Gets the item’s type, represented as an ItemType. |
setHelpText | Item | Sets the item’s help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems). |
setTitle | Item | Sets the item’s title (sometimes called header text, in the case of a SectionHeaderItem). |
列挙型名一覧
列挙型一覧
列挙型のメソッドを利用するときには、基本的には『FormApp.列挙型名.プロパティ名』の形で利用します。例えば、AlignmentのLEFTを設定したい場合は、『FormApp.Alignment.LEFT』という形で記述します。
Enum Alignment
画像の揃えを設定できます。
プロパティ | タイプ | 説明 |
---|---|---|
LEFT | Enum | 画像をフォームの左に揃える |
CENTER | Enum | 画像をフォームの中央に揃える |
RIGHT | Enum | 画像をフォームの右に揃える |
Enum DestinationType
フォームデータの保存先を設定できます。保存先を設定しているかどうかに関わらず、すべてのフォームデータは回答のコピーとしてフォームファイルに保存されています。保存先を設定するためにはsetDestinationメソッドと『FormApp.DestinationType.プロパティ名』を併用することで設定ができます。
プロパティ | タイプ | 説明 |
---|---|---|
SPREADSHEET | Enum | 保存先のスプレッドシートを設定 |
Enum FeedbackType
フィードバックの表示方法を設定できます。
プロパティ | タイプ | 説明 |
---|---|---|
CORRECT | Enum | Feedback 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) |
INCORRECT | Enum | Feedback 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) |
GENERAL | Enum | Feedback 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.プロパティ名』で条件を設定します。
CHECKBOX | Enum | A question item that allows the respondent to select one or more checkboxes, as well as an optional “other” field. |
CHECKBOX_GRID | Enum | A 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. |
DATE | Enum | A question item that allows the respondent to indicate a date. |
DATETIME | Enum | A question item that allows the respondent to indicate a date and time. |
DURATION | Enum | A question item that allows the respondent to indicate a length of time. |
GRID | Enum | A 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. |
IMAGE | Enum | A layout item that displays an image. |
LIST | Enum | A question item that allows the respondent to select one choice from a drop-down list. |
MULTIPLE_CHOICE | Enum | A question item that allows the respondent to select one choice from a list of radio buttons or an optional “other” field. |
PAGE_BREAK | Enum | A 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. |
SCALE | Enum | A question item that allows the respondent to choose one option from a numbered sequence of radio buttons. |
SECTION_HEADER | Enum | A layout item that visually indicates the start of a section. |
TEXT | Enum | A question item that allows the respondent to enter a single line of text. |
TIME | Enum | A question item that allows the respondent to indicate a time of day. |
VIDEO | Enum | A layout item that displays a YouTube video. |
Enum PageNavigationType
ページナビゲーションタイプを設定します。
ページナビゲーションは項目の選択肢にページナビゲーションが設定されていて、回答者がその選択肢を選んだときに動作します。選択肢の中から複数の選択をして、それぞれの選択肢にページナビゲーションが設定されている場合は、最後に選択肢たページナビゲーションのみ実行されます。
また、最後のページに設定されているページナビゲーションは実行されません。
ページナビゲーションを設定された選択肢は、設定されていない選択肢と一緒に一つの項目に設定することはできません。
プロパティ | タイプ | 説明 |
---|---|---|
CONTINUE | Enum | 現在のページが終わったら、次のページに進みます。通常はデフォルト設定ですが、ページナビゲーションを設定する場合は明示的に設定する必要があります。 |
GO_TO_PAGE | Enum | 現在のページが終わったら、特定のページに進みます。 |
RESTART | Enum | 現在のページが終わったら、すでに入力されたデータはそのままの状態でフォームの最初に戻ります。 |
SUBMIT | Enum | 現在のページが終わったら、フォームを送信します。 |
コメント