Forms Service

  • The Google Forms service allows scripts to create, access, and modify Google Forms.

  • An example script demonstrates creating a form with various item types, publishing it, and sharing it.

  • The documentation lists numerous classes within the Forms service, including items, responses, validation builders, and enums.

  • Detailed information on properties and methods is provided for many of the listed classes, outlining their specific functionalities.

Forms

This service allows scripts to create, access, and modify Google Forms.

//Createanewunpublishedform,thenaddacheckboxquestion,amultiplechoicequestion,
//apagebreak,thenadatequestionandagridofquestions,thenpublishtheformandshare
//withresponders.
varform=FormApp.create('New Form',/*isPublished=*/false);
varitem=form.addCheckboxItem();
item.setTitle('What condiments would you like on your hot dog?');
item.setChoices([
item.createChoice('Ketchup'),
item.createChoice('Mustard'),
item.createChoice('Relish')
]);
form.addMultipleChoiceItem()
.setTitle('Do you prefer cats or dogs?')
.setChoiceValues(['Cats','Dogs'])
.showOtherOption(true);
form.addPageBreakItem()
.setTitle('Getting to know you');
form.addDateItem()
.setTitle('When were you born?');
form.addGridItem()
.setTitle('Rate your interests')
.setRows(['Cars','Computers','Celebrities'])
.setColumns(['Boring','So-so','Interesting']);
form.setPublished(true);
form.addPublishedReaders(['user@example.com','group@example.com']);
Logger.log('Published URL: '+form.getPublishedUrl());
Logger.log('Editor URL: '+form.getEditUrl());

Classes

NameBrief description
Alignment An enum representing the supported types of image alignment.
CheckboxGridItem 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.
CheckboxGridValidation A DataValidation for a CheckboxGridItem .
CheckboxGridValidationBuilder A DataValidationBuilder for a CheckboxGridValidation .
CheckboxItem A question item that allows the respondent to select one or more checkboxes, as well as an optional "other" field.
CheckboxValidation A DataValidation for a CheckboxItem .
CheckboxValidationBuilder A DataValidationBuilder for a CheckboxValidation .
Choice A single choice associated with a type of Item that supports choices, like CheckboxItem , ListItem , or MultipleChoiceItem .
DateItem A question item that allows the respondent to indicate a date.
DateTimeItem A question item that allows the respondent to indicate a date and time.
DestinationType An enum representing the supported types of form-response destinations.
DurationItem A question item that allows the respondent to indicate a length of time.
FeedbackType An enum representing the supported types of feedback.
Form A form that contains overall properties and items.
FormApp Allows a script to open an existing Form or create a new one.
FormResponse A response to the form as a whole.
GridItem 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.
GridValidation A DataValidation for a GridItem .
GridValidationBuilder A DataValidationBuilder for a GridValidation .
ImageItem A layout item that displays an image.
Item A generic form item that contains properties common to all items, such as title and help text.
ItemResponse A response to one question item within a form.
ItemType An enum representing the supported types of form items.
ListItem A question item that allows the respondent to select one choice from a drop-down list.
MultipleChoiceItem A question item that allows the respondent to select one choice from a list of radio buttons or an optional "other" field.
PageBreakItem A layout item that marks the start of a page.
PageNavigationType An enum representing the supported types of page navigation.
ParagraphTextItem A question item that allows the respondent to enter a block of text.
ParagraphTextValidation A DataValidation for a ParagraphTextItem .
ParagraphTextValidationBuilder A DataValidationBuilder for a ParagraphTextValidation .
QuizFeedback The bean implementation of a Feedback, which contains properties common to all feedback, such as display text or links.
QuizFeedbackBuilder The base FeedbackBuilder that contains setters for properties common to all feedback, such as display text.
RatingIconType An enum representing the supported types of rating icons.
RatingItem A question item that allows the respondent to give a rating.
ScaleItem A question item that allows the respondent to choose one option from a numbered sequence of radio buttons.
SectionHeaderItem A layout item that visually indicates the start of a section.
TextItem A question item that allows the respondent to enter a single line of text.
TextValidation A DataValidation for a TextItem .
TextValidationBuilder A DataValidationBuilder for a TextValidation .
TimeItem A question item that allows the respondent to indicate a time of day.
VideoItem A layout item that displays a video.

Alignment

Properties

PropertyTypeDescription
LEFTEnumAlign the image to the left side of the form.
CENTEREnumAlign the image to the center of the form.
RIGHTEnumAlign the image to the right side of the form.

CheckboxGridItem

Methods

MethodReturn typeBrief description
clearValidation() CheckboxGridItem Removes any data validation for this grid item.
createResponse(responses) 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() StringGets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
getId() IntegerGets the item's unique identifier.
getIndex() IntegerGets the index of the item among all the items in the form.
getRows() String[]Gets the values for every row in the grid.
getTitle() StringGets 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() BooleanDetermines whether the respondent must answer the question.
setColumns(columns) CheckboxGridItem Sets the columns of the grid based on an array of values.
setHelpText(text) CheckboxGridItem Sets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
setRequired(enabled) CheckboxGridItem Sets whether the respondent must answer the question.
setRows(rows) CheckboxGridItem Sets the rows of the grid based on an array of values.
setTitle(title) CheckboxGridItem Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem ).
setValidation(validation) CheckboxGridItem Sets the data validation for this checkbox grid item.

CheckboxGridValidation

CheckboxGridValidationBuilder

Methods

MethodReturn typeBrief description
requireLimitOneResponsePerColumn() CheckboxGridValidationBuilder Requires limit of one response per column for a grid item.

CheckboxItem

Methods

MethodReturn typeBrief description
clearValidation() CheckboxItem Removes any data validation for this checkbox item.
createChoice(value) Choice Creates a new choice.
createChoice(value, isCorrect) Choice Creates a new choice.
createResponse(responses) 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.
getFeedbackForIncorrect() QuizFeedback Returns the feedback that is shown to respondents when they respond incorrectly to a question.
getHelpText() StringGets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
getId() IntegerGets the item's unique identifier.
getIndex() IntegerGets the index of the item among all the items in the form.
getPoints() IntegerReturns the point value of a gradeable item.
getTitle() StringGets 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() BooleanDetermines whether the item has an "other" option.
isRequired() BooleanDetermines whether the respondent must answer the question.
setChoiceValues(values) CheckboxItem Sets the choices for an item from an array of strings.
setChoices(choices) CheckboxItem Sets an array of choices for an item.
setFeedbackForCorrect(feedback) CheckboxItem Sets the feedback to be shown to respondents when they respond correctly to a question.
setFeedbackForIncorrect(feedback) CheckboxItem Sets the feedback to be shown to respondents when they respond incorrectly to a question.
setHelpText(text) CheckboxItem Sets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
setPoints(points) CheckboxItem Sets the number of points a gradeable item is worth.
setRequired(enabled) CheckboxItem Sets whether the respondent must answer the question.
setTitle(title) CheckboxItem Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem ).
setValidation(validation) CheckboxItem Sets the data validation for this checkbox item.
showOtherOption(enabled) CheckboxItem Sets whether the item has an "other" option.

CheckboxValidation

CheckboxValidationBuilder

Methods

MethodReturn typeBrief description
requireSelectAtLeast(number) CheckboxValidationBuilder Require at least this many choices to be selected.
requireSelectAtMost(number) CheckboxValidationBuilder Require at most this many choices to be selected.
requireSelectExactly(number) CheckboxValidationBuilder Require exactly this many choices to be selected.

Choice

Methods

MethodReturn typeBrief description
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() StringGets the choice's value, which respondents see as a label when viewing the form.
isCorrectAnswer() BooleanGets whether the choice is a correct answer for the question.

DateItem

Methods

MethodReturn typeBrief description
createResponse(response) 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() StringGets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
getId() IntegerGets the item's unique identifier.
getIndex() IntegerGets the index of the item among all the items in the form.
getPoints() IntegerReturns the point value of a gradeable item.
getTitle() StringGets 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() BooleanDetermines whether the date item includes a year option.
isRequired() BooleanDetermines whether the respondent must answer the question.
setGeneralFeedback(feedback) 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(text) DateItem Sets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
setIncludesYear(enableYear) DateItem Sets whether the date item includes a year setting.
setPoints(points) DateItem Sets the number of points a gradeable item is worth.
setRequired(enabled) DateItem Sets whether the respondent must answer the question.
setTitle(title) DateItem Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem ).

DateTimeItem

Methods

MethodReturn typeBrief description
createResponse(response) 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() StringGets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
getId() IntegerGets the item's unique identifier.
getIndex() IntegerGets the index of the item among all the items in the form.
getPoints() IntegerReturns the point value of a gradeable item.
getTitle() StringGets 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() BooleanDetermines whether the date item includes a year option.
isRequired() BooleanDetermines whether the respondent must answer the question.
setGeneralFeedback(feedback) 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(text) DateTimeItem Sets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
setIncludesYear(enableYear) DateTimeItem Sets whether the date item includes a year setting.
setPoints(points) DateTimeItem Sets the number of points a gradeable item is worth.
setRequired(enabled) DateTimeItem Sets whether the respondent must answer the question.
setTitle(title) DateTimeItem Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem ).

DestinationType

Properties

PropertyTypeDescription
SPREADSHEETEnumA Google Sheets spreadsheet as a destination for form responses.

DurationItem

Methods

MethodReturn typeBrief description
createResponse(hours, minutes, seconds) 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() StringGets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
getId() IntegerGets the item's unique identifier.
getIndex() IntegerGets the index of the item among all the items in the form.
getPoints() IntegerReturns the point value of a gradeable item.
getTitle() StringGets 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() BooleanDetermines whether the respondent must answer the question.
setGeneralFeedback(feedback) 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(text) DurationItem Sets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
setPoints(points) DurationItem Sets the number of points a gradeable item is worth.
setRequired(enabled) DurationItem Sets whether the respondent must answer the question.
setTitle(title) DurationItem Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem ).

FeedbackType

Properties

PropertyTypeDescription
CORRECTEnumFeedback that is automatically displayed to respondents for a question answered correctly.
INCORRECTEnumFeedback that is automatically displayed to respondents for a question answered incorrectly.
GENERALEnumFeedback that is automatically displayed to respondents when they submit their response.

Form

Methods

MethodReturn typeBrief description
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(emailAddress) Form Adds the given user to the list of editors for the Form .
addEditor(user) Form Adds the given user to the list of editors for the Form .
addEditors(emailAddresses) 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 dropdown list.
addMultipleChoiceItem() MultipleChoiceItem Adds 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 Adds a new layout item that marks the start of a page.
addParagraphTextItem() ParagraphTextItem Adds a new question item that allows the respondent to enter a block of text.
addPublishedReader(emailAddress) Form Adds the given user to the list of responders for the Form .
addPublishedReader(user) Form Adds the given user to the list of responders for the Form .
addPublishedReaders(emailAddresses) Form Adds the given array of users to the list of responders for the Form .
addRatingItem() RatingItem Appends a new question item that allows the respondent to give a rating.
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() BooleanDetermines whether the form displays a link to edit a response after submitting it.
collectsEmail() BooleanDetermines 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(index) voidDeletes the item at a given index among all the items in the form.
deleteItem(item) voidDeletes the given item.
deleteResponse(responseId) Form Deletes a single response from the form's response store.
getConfirmationMessage() StringGets the form's confirmation message.
getCustomClosedFormMessage() StringGets the custom message that is displayed if the form is not accepting responses, or an empty string if no custom message is set.
getDescription() StringGets the form's description.
getDestinationId() StringGets the ID of the form's response destination.
getDestinationType() DestinationType Gets the type of the form's response destination.
getEditUrl() StringGets the URL that can be used to access the form's edit mode.
getEditors() User[] Gets the list of editors for this Form .
getId() StringGets the ID of the form.
getItemById(id) Item Gets the item with a given ID.
getItems() Item[] Gets an array of all items in the form.
getItems(itemType) Item[] Gets an array of all items of a given type.
getPublishedReaders() User[] Gets the list of responders for this Form .
getPublishedUrl() StringGets the URL that can be used to respond to the form.
getResponse(responseId) FormResponse Gets a single form response based on its response ID.
getResponses() FormResponse[] Gets an array of all of the form's responses.
getResponses(timestamp) FormResponse[] Gets an array of all of the form's responses after a given date and time.
getShuffleQuestions() BooleanDetermines whether the order of the questions on each page of the form is randomized.
getSummaryUrl() StringGets the URL that can be used to view a summary of the form's responses.
getTitle() StringGets the form's title.
hasLimitOneResponsePerUser() BooleanDetermines whether the form allows only one response per respondent.
hasProgressBar() BooleanDetermines whether the form displays a progress bar.
hasRespondAgainLink() BooleanDetermines whether the form displays a link to submit another response after a respondent completes the form.
isAcceptingResponses() BooleanDetermines whether the form is currently accepting responses.
isPublished() BooleanDetermines whether the form is published.
isPublishingSummary() BooleanDetermines whether the form displays a link to view a summary of responses after a respondent completes the form.
isQuiz() BooleanDetermines whether the form is a quiz.
moveItem(from, to) Item Moves an item at a given index among all the items in the form to another given index.
moveItem(item, toIndex) Item Moves a given item to a given index among all the items in the form.
removeDestination() Form Unlinks the form from its current response destination.
removeEditor(emailAddress) Form Removes the given user from the list of editors for the Form .
removeEditor(user) Form Removes the given user from the list of editors for the Form .
removePublishedReader(emailAddress) Form Removes the given user from the list of responders for the Form .
removePublishedReader(user) Form Removes the given user from the list of responders for the Form .
setAcceptingResponses(enabled) Form Sets whether the form is currently accepting responses.
setAllowResponseEdits(enabled) Form Sets whether the form displays a link to edit a response after submitting it.
setCollectEmail(collect) Form Sets whether the form collects respondents' email addresses.
setConfirmationMessage(message) Form Sets the form's confirmation message.
setCustomClosedFormMessage(message) Form Sets the message to display if the form is not accepting responses.
setDescription(description) Form Sets the form's description.
setDestination(type, id) Form Sets the destination where form responses are saved.
setIsQuiz(enabled) Form Sets whether the form is a quiz.
setLimitOneResponsePerUser(enabled) Form Sets whether the form allows only one response per respondent.
setProgressBar(enabled) Form Sets whether the form has a progress bar.
setPublished(enabled) Form Sets whether the form is published.
setPublishingSummary(enabled) Form Sets whether the form displays a link to view a summary of responses after a respondent submits the form.
setShowLinkToRespondAgain(enabled) Form Sets whether the form displays a link to submit another response after a respondent completes the form.
setShuffleQuestions(shuffle) Form Sets whether the order of the questions on each page of the form is randomized.
setTitle(title) Form Sets the form's title.
shortenFormUrl(url) StringConverts a long URL for a form to a short URL.
submitGrades(responses) Form Submits grades for the given FormResponses.
supportsAdvancedResponderPermissions() BooleanDetermines whether the form supports publishing.

FormApp

Properties

PropertyTypeDescription
AlignmentAlignment An enumeration of types of image alignment.
DestinationTypeDestinationType An enumeration of types of destinations that can store form responses.
FeedbackTypeFeedbackType An enumeration of types of form Feedbacks .
ItemTypeItemType An enumeration of types of form Items .
PageNavigationTypePageNavigationType An enumeration of possible behaviors for navigating pages.
RatingIconTypeRatingIconType An enumeration of rating icon types RatingIcons

Methods

MethodReturn typeBrief description
create(title) Form Creates and returns a new Form .
create(title, isPublished) Form Creates and returns a new Form in the requested publish state.
createCheckboxGridValidation() CheckboxGridValidationBuilder Returns an instance of a CheckboxGridValidationBuilder which can be used to set validation on a CheckboxGridItem .
createCheckboxValidation() CheckboxValidationBuilder Returns an instance of a CheckboxValidationBuilder which can be used to set validation on a CheckboxItem .
createFeedback() QuizFeedbackBuilder Returns an instance of a QuizFeedbackBuilder which can be used to set feedback on a gradeable Item .
createGridValidation() GridValidationBuilder Returns an instance of a GridValidationBuilder which can be used to set validation on a GridItem .
createParagraphTextValidation() ParagraphTextValidationBuilder Returns an instance of a ParagraphTextValidationBuilder which can be used to set validation on a ParagraphTextItem .
createTextValidation() TextValidationBuilder Returns an instance of a TextValidationBuilder which can be used to set validation on a TextItem .
getActiveForm() Form Returns the form to which the script is container-bound.
getUi() Ui Returns an instance of the form editor's user-interface environment that allows the script to add features like menus, dialogs, and sidebars.
openById(id) Form Returns the Form with the specified ID.
openByUrl(url) Form Returns the Form with the specified URL.

FormResponse

Methods

MethodReturn typeBrief description
getEditResponseUrl() StringGenerates 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(item) ItemResponse Gets the item response contained in a form response for a given item.
getId() StringGets 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() StringGets the email address of the person who submitted a response, if the Form.setCollectEmail(collect) setting is enabled.
getResponseForItem(item) ItemResponse Gets the item response contained in this form response for a given item.
getTimestamp() DateGets the timestamp for a form response submission.
submit() FormResponse Submits the response.
toPrefilledUrl() StringGenerates a URL for the form in which the answers are pre-filled based on the answers in this form response.
withItemGrade(gradedResponse) FormResponse Adds the given item response's grades to a form response.
withItemResponse(response) FormResponse Adds the given item response to a form response.

GridItem

Methods

MethodReturn typeBrief description
clearValidation() GridItem Removes any data validation for this grid item.
createResponse(responses) 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() StringGets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
getId() IntegerGets the item's unique identifier.
getIndex() IntegerGets the index of the item among all the items in the form.
getRows() String[]Gets the values for every row in the grid.
getTitle() StringGets 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() BooleanDetermines whether the respondent must answer the question.
setColumns(columns) GridItem Sets the columns of the grid based on an array of values.
setHelpText(text) GridItem Sets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
setRequired(enabled) GridItem Sets whether the respondent must answer the question.
setRows(rows) GridItem Sets the rows of the grid based on an array of values.
setTitle(title) GridItem Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem ).
setValidation(validation) GridItem Sets the data validation for this grid item.

GridValidation

GridValidationBuilder

Methods

MethodReturn typeBrief description
requireLimitOneResponsePerColumn() GridValidationBuilder Requires limit of one response per column for a grid item.

ImageItem

Methods

MethodReturn typeBrief description
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() StringGets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
getId() IntegerGets the item's unique identifier.
getImage() Blob Gets the image that is currently assigned to the item.
getIndex() IntegerGets the index of the item among all the items in the form.
getTitle() StringGets 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() IntegerGets the image's width in pixels.
setAlignment(alignment) ImageItem Sets the image's horizontal alignment.
setHelpText(text) ImageItem Sets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
setImage(image) ImageItem Sets the image itself.
setTitle(title) ImageItem Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem ).
setWidth(width) ImageItem Sets the image's width in pixels.

Item

Methods

MethodReturn typeBrief description
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.
asRatingItem() RatingItem Returns the item as a rating 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() StringGets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
getId() IntegerGets the item's unique identifier.
getIndex() IntegerGets the index of the item among all the items in the form.
getTitle() StringGets 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(text) Item Sets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
setTitle(title) Item Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem ).

ItemResponse

Methods

MethodReturn typeBrief description
getFeedback() ObjectGets the feedback that was given for the respondent's submitted answer.
getItem() Item Gets the question item that this response answers.
getResponse() ObjectGets the answer that the respondent submitted.
getScore() ObjectGets the score for the respondent's submitted answer.
setFeedback(feedback) ItemResponse Sets the feedback that should be displayed for the respondent's submitted answer.
setScore(score) ItemResponse Sets the score for the respondent's submitted answer.

ItemType

Properties

PropertyTypeDescription
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_TEXTEnumA question item that allows the respondent to enter a block of text.
RATINGEnumA question item that allows the respondent to give a rating.
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.
TEXTEnumA 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.
FILE_UPLOADEnumA question item that lets the respondent upload a file.
UNSUPPORTEDEnumAn item that is currently not supported through APIs.

ListItem

Methods

MethodReturn typeBrief description
createChoice(value) Choice Creates a new choice.
createChoice(value, isCorrect) Choice Creates a new choice.
createChoice(value, navigationItem) Choice Creates a new choice with a page-navigation option that jumps to a given page-break item.
createChoice(value, navigationType) Choice Creates a new choice with a page-navigation option.
createResponse(response) 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() StringGets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
getId() IntegerGets the item's unique identifier.
getIndex() IntegerGets the index of the item among all the items in the form.
getPoints() IntegerReturns the point value of a gradeable item.
getTitle() StringGets 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() BooleanDetermines whether the respondent must answer the question.
setChoiceValues(values) ListItem Sets the choices for an item from an array of strings.
setChoices(choices) ListItem Sets an array of choices for an item.
setFeedbackForCorrect(feedback) ListItem Sets the feedback to be shown to respondents when they respond correctly to a question.
setFeedbackForIncorrect(feedback) ListItem Sets the feedback to be shown to respondents when they respond incorrectly to a question.
setHelpText(text) ListItem Sets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
setPoints(points) ListItem Sets the number of points a gradeable item is worth.
setRequired(enabled) ListItem Sets whether the respondent must answer the question.
setTitle(title) ListItem Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem ).

MultipleChoiceItem

Methods

MethodReturn typeBrief description
createChoice(value) Choice Creates a new choice.
createChoice(value, isCorrect) Choice Creates a new choice.
createChoice(value, navigationItem) Choice Creates a new choice with a page-navigation option that jumps to a given page-break item.
createChoice(value, navigationType) Choice Creates a new choice with a page-navigation option.
createResponse(response) 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() StringGets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
getId() IntegerGets the item's unique identifier.
getIndex() IntegerGets the index of the item among all the items in the form.
getPoints() IntegerReturns the point value of a gradeable item.
getTitle() StringGets 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() BooleanDetermines whether the item has an "other" option.
isRequired() BooleanDetermines whether the respondent must answer the question.
setChoiceValues(values) MultipleChoiceItem Sets the choices for an item from an array of strings.
setChoices(choices) MultipleChoiceItem Sets an array of choices for an item.
setFeedbackForCorrect(feedback) MultipleChoiceItem Sets the feedback to be shown to respondents when they respond correctly to a question.
setFeedbackForIncorrect(feedback) MultipleChoiceItem Sets the feedback to be shown to respondents when they respond incorrectly to a question.
setHelpText(text) MultipleChoiceItem Sets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
setPoints(points) MultipleChoiceItem Sets the number of points a gradeable item is worth.
setRequired(enabled) MultipleChoiceItem Sets whether the respondent must answer the question.
setTitle(title) MultipleChoiceItem Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem ).
showOtherOption(enabled) MultipleChoiceItem Sets whether the item has an "other" option.

PageBreakItem

Methods

MethodReturn typeBrief description
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() StringGets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
getId() IntegerGets the item's unique identifier.
getIndex() IntegerGets 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() StringGets 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(goToPageItem) 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).
setGoToPage(navigationType) PageBreakItem Sets 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).
setHelpText(text) PageBreakItem Sets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
setTitle(title) PageBreakItem Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem ).

Properties

PropertyTypeDescription
CONTINUEEnumContinue to the next page of the form after completing the current page.
GO_TO_PAGEEnumJump to a specified page of the form after completing the current page.
RESTARTEnumRestart the form from the beginning, without clearing answers entered so far, after completing the current page.
SUBMITEnumSubmit the form response after completing the current page.

ParagraphTextItem

Methods

MethodReturn typeBrief description
clearValidation() ParagraphTextItem Removes any data validation for this paragraph text item.
createResponse(response) 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() StringGets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
getId() IntegerGets the item's unique identifier.
getIndex() IntegerGets the index of the item among all the items in the form.
getPoints() IntegerReturns the point value of a gradeable item.
getTitle() StringGets 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() BooleanDetermines whether the respondent must answer the question.
setGeneralFeedback(feedback) 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(text) ParagraphTextItem Sets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
setPoints(points) ParagraphTextItem Sets the number of points a gradeable item is worth.
setRequired(enabled) ParagraphTextItem Sets whether the respondent must answer the question.
setTitle(title) ParagraphTextItem Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem ).
setValidation(validation) ParagraphTextItem Sets the data validation for this paragraph text item.

ParagraphTextValidation

ParagraphTextValidationBuilder

Methods

MethodReturn typeBrief description
requireTextContainsPattern(pattern) ParagraphTextValidationBuilder Requires response to contain pattern.
requireTextDoesNotContainPattern(pattern) ParagraphTextValidationBuilder Requires response to not contain pattern.
requireTextDoesNotMatchPattern(pattern) ParagraphTextValidationBuilder Requires response to not match pattern.
requireTextLengthGreaterThanOrEqualTo(number) ParagraphTextValidationBuilder Requires response length to be greater than or equal to value.
requireTextLengthLessThanOrEqualTo(number) ParagraphTextValidationBuilder Requires response length to be less than value.
requireTextMatchesPattern(pattern) ParagraphTextValidationBuilder Requires response to match pattern.

QuizFeedback

Methods

MethodReturn typeBrief description
getLinkUrls() String[]Gets a list of the URLs associated with the Feedback.
getText() StringGets the Feedback's display text.

QuizFeedbackBuilder

Methods

MethodReturn typeBrief description
addLink(url) QuizFeedbackBuilder Adds a link to the feedback's supplemental material.
addLink(url, displayText) 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(text) QuizFeedbackBuilder Sets the feedback text.

RatingIconType

Properties

PropertyTypeDescription
STAREnumA star icon.
HEARTEnumA heart icon.
THUMB_UPEnumA thumb up icon.

RatingItem

Methods

MethodReturn typeBrief description
createResponse(response) ItemResponse Creates a new ItemResponse for this rating item.
duplicate() RatingItem 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() StringGets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
getId() IntegerGets the item's unique identifier.
getIndex() IntegerGets the index of the item among all the items in the form.
getPoints() IntegerReturns the point value of a gradeable item.
getRatingIcon() RatingIconType Gets the icon chosen for the rating.
getRatingScaleLevel() IntegerGets the rating's scale level.
getTitle() StringGets 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() BooleanDetermines whether the respondent must answer the question.
setGeneralFeedback(feedback) RatingItem 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(text) RatingItem Sets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
setPoints(points) RatingItem Sets the number of points a gradeable item is worth.
setRatingIcon(ratingIcon) RatingItem Sets the rating's icon.
setRatingScaleLevel(ratingScaleLevel) RatingItem Sets the rating's maximum scale level.
setRequired(enabled) RatingItem Sets whether the respondent must answer the question.
setTitle(title) RatingItem Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem ).

ScaleItem

Methods

MethodReturn typeBrief description
createResponse(response) 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() StringGets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
getId() IntegerGets the item's unique identifier.
getIndex() IntegerGets the index of the item among all the items in the form.
getLeftLabel() StringGets the label for the scale's lower bound, if any.
getLowerBound() IntegerGets the scale's lower bound.
getPoints() IntegerReturns the point value of a gradeable item.
getRightLabel() StringGets the label for the scale's upper bound, if any.
getTitle() StringGets 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() IntegerGets the scale's upper bound.
isRequired() BooleanDetermines whether the respondent must answer the question.
setBounds(lower, upper) ScaleItem Sets the scale's lower and upper bounds.
setGeneralFeedback(feedback) 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(text) ScaleItem Sets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
setLabels(lower, upper) ScaleItem Sets labels for the scale's lower and upper bounds.
setPoints(points) ScaleItem Sets the number of points a gradeable item is worth.
setRequired(enabled) ScaleItem Sets whether the respondent must answer the question.
setTitle(title) ScaleItem Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem ).

SectionHeaderItem

Methods

MethodReturn typeBrief description
duplicate() SectionHeaderItem Creates a copy of this item and appends it to the end of the form.
getHelpText() StringGets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
getId() IntegerGets the item's unique identifier.
getIndex() IntegerGets the index of the item among all the items in the form.
getTitle() StringGets 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(text) SectionHeaderItem Sets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
setTitle(title) SectionHeaderItem Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem ).

TextItem

Methods

MethodReturn typeBrief description
clearValidation() TextItem Removes any data validation for this text item.
createResponse(response) 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() StringGets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
getId() IntegerGets the item's unique identifier.
getIndex() IntegerGets the index of the item among all the items in the form.
getPoints() IntegerReturns the point value of a gradeable item.
getTitle() StringGets 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() BooleanDetermines whether the respondent must answer the question.
setGeneralFeedback(feedback) 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(text) TextItem Sets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
setPoints(points) TextItem Sets the number of points a gradeable item is worth.
setRequired(enabled) TextItem Sets whether the respondent must answer the question.
setTitle(title) TextItem Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem ).
setValidation(validation) TextItem Sets the data validation for this text item.

TextValidation

TextValidationBuilder

Methods

MethodReturn typeBrief description
requireNumber() TextValidationBuilder Requires text item to be a number.
requireNumberBetween(start, end) TextValidationBuilder Requires text item to be a number between start and end, inclusive.
requireNumberEqualTo(number) TextValidationBuilder Requires text item to be a number equal to value specified.
requireNumberGreaterThan(number) TextValidationBuilder Requires text item to be a number greater than the value specified.
requireNumberGreaterThanOrEqualTo(number) TextValidationBuilder Requires text item to be a number greater than or equal to the value specified.
requireNumberLessThan(number) TextValidationBuilder Requires text item to be a number less than the value specified.
requireNumberLessThanOrEqualTo(number) TextValidationBuilder Requires text item to be a number less than or equal to the value specified.
requireNumberNotBetween(start, end) TextValidationBuilder Requires text item to be a number not between start and end, inclusive.
requireNumberNotEqualTo(number) TextValidationBuilder Requires text item to be a number not equal to the value specified.
requireTextContainsPattern(pattern) TextValidationBuilder Requires response to contain pattern.
requireTextDoesNotContainPattern(pattern) TextValidationBuilder Requires response to not contain pattern.
requireTextDoesNotMatchPattern(pattern) 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(number) TextValidationBuilder Requires response length to be greater than or equal to value.
requireTextLengthLessThanOrEqualTo(number) TextValidationBuilder Requires response length to be less than value.
requireTextMatchesPattern(pattern) TextValidationBuilder Requires response to match pattern.
requireWholeNumber() TextValidationBuilder Requires text item to be a whole number.

TimeItem

Methods

MethodReturn typeBrief description
createResponse(hour, minute) 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() StringGets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
getId() IntegerGets the item's unique identifier.
getIndex() IntegerGets the index of the item among all the items in the form.
getPoints() IntegerReturns the point value of a gradeable item.
getTitle() StringGets 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() BooleanDetermines whether the respondent must answer the question.
setGeneralFeedback(feedback) 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(text) TimeItem Sets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
setPoints(points) TimeItem Sets the number of points a gradeable item is worth.
setRequired(enabled) TimeItem Sets whether the respondent must answer the question.
setTitle(title) TimeItem Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem ).

VideoItem

Methods

MethodReturn typeBrief description
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() StringGets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
getId() IntegerGets the item's unique identifier.
getIndex() IntegerGets the index of the item among all the items in the form.
getTitle() StringGets 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() IntegerGets the video's width in pixels.
setAlignment(alignment) VideoItem Sets the video's horizontal alignment.
setHelpText(text) VideoItem Sets the item's help text (sometimes called description text for layout items like ImageItems , PageBreakItems , and SectionHeaderItems ).
setTitle(title) VideoItem Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem ).
setVideoUrl(youtubeUrl) VideoItem Sets the video itself from a given YouTube URL or YouTube video ID.
setWidth(width) VideoItem Sets the video's width in pixels.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年04月08日 UTC.