Class Form

Biểu mẫu

Biểu mẫu chứa các thuộc tính và mục tổng thể. Các thuộc tính bao gồm tiêu đề, chế độ cài đặt và nơi lưu trữ phản hồi. Các mục bao gồm các mục câu hỏi như hộp đánh dấu hoặc mục radio, trong khi các mục bố cục đề cập đến những mục như ngắt trang. Bạn có thể truy cập hoặc tạo biểu mẫu bằng FormApp.

// Open a form by ID and create a new spreadsheet.
var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
var ss = SpreadsheetApp.create('Spreadsheet Name');

// Update form properties via chaining.
form.setTitle('Form Name')
    .setDescription('Description of form')
    .setConfirmationMessage('Thanks for responding!')
    .setAllowResponseEdits(true)
    .setAcceptingResponses(false);

// Update the form's response destination.
form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());

Phương thức

Phương thứcKiểu dữ liệu trả vềMô tả ngắn
addCheckboxGridItem()CheckboxGridItemThêm một mục câu hỏi mới (được trình bày dưới dạng lưới gồm các cột và hàng) cho phép người trả lời chọn nhiều lựa chọn cho mỗi hàng trong một chuỗi các hộp đánh dấu.
addCheckboxItem()CheckboxItemThêm một mục câu hỏi mới cho phép người trả lời chọn một hoặc nhiều hộp đánh dấu, cũng như trường "other" (không bắt buộc).
addDateItem()DateItemThêm một mục mới cho câu hỏi để người trả lời có thể cho biết ngày.
addDateTimeItem()DateTimeItemThêm một mục mới cho câu hỏi để người trả lời có thể cho biết ngày và giờ.
addDurationItem()DurationItemThêm một mục câu hỏi mới cho phép người trả lời nêu rõ khoảng thời gian.
addEditor(emailAddress)FormThêm người dùng đã cho vào danh sách người chỉnh sửa của Form.
addEditor(user)FormThêm người dùng đã cho vào danh sách người chỉnh sửa của Form.
addEditors(emailAddresses)FormThêm mảng người dùng đã cho vào danh sách trình chỉnh sửa của Form.
addGridItem()GridItemThêm một mục câu hỏi mới (được trình bày dưới dạng lưới gồm các cột và hàng) cho phép người trả lời chọn một lựa chọn cho mỗi hàng trong một chuỗi các nút chọn.
addImageItem()ImageItemThêm một mục bố cục mới có hiển thị hình ảnh.
addListItem()ListItemThêm một mục câu hỏi mới cho phép người trả lời chọn một câu trả lời trong danh sách thả xuống.
addMultipleChoiceItem()MultipleChoiceItemThêm một mục câu hỏi mới cho phép người trả lời chọn một lựa chọn trong danh sách các nút chọn hoặc trường "khác" (không bắt buộc).
addPageBreakItem()PageBreakItemThêm một mục bố cục mới đánh dấu phần đầu của một trang.
addParagraphTextItem()ParagraphTextItemThêm một mục câu hỏi mới để người trả lời có thể nhập một khối văn bản.
addScaleItem()ScaleItemThêm một mục câu hỏi mới cho phép người trả lời chọn một đáp án trong một chuỗi các nút chọn được đánh số.
addSectionHeaderItem()SectionHeaderItemThêm một mục bố cục mới cho biết phần đầu của một phần (một cách trực quan).
addTextItem()TextItemThêm một mục câu hỏi mới để người trả lời nhập một dòng văn bản.
addTimeItem()TimeItemThêm một mục câu hỏi mới cho phép người trả lời chỉ rõ thời gian trong ngày.
addVideoItem()VideoItemThêm một mục bố cục mới sẽ hiển thị video.
canEditResponse()BooleanXác định xem biểu mẫu có hiển thị đường liên kết để chỉnh sửa câu trả lời sau khi gửi hay không.
collectsEmail()BooleanXác định xem biểu mẫu có thu thập địa chỉ email của người trả lời hay không.
createResponse()FormResponseTạo phản hồi mới cho biểu mẫu.
deleteAllResponses()FormXoá tất cả câu trả lời đã gửi khỏi kho câu trả lời của biểu mẫu.
deleteItem(index)voidXoá mục tại chỉ mục đã cho trong số tất cả các mục trong biểu mẫu.
deleteItem(item)voidXoá mục đã cho.
deleteResponse(responseId)FormXoá một câu trả lời khỏi kho câu trả lời của biểu mẫu.
getConfirmationMessage()StringNhận thông báo xác nhận của biểu mẫu.
getCustomClosedFormMessage()StringLấy thông báo tuỳ chỉnh hiển thị nếu biểu mẫu không chấp nhận phản hồi, hoặc một chuỗi trống nếu không có thông báo tuỳ chỉnh nào được đặt.
getDescription()StringLấy nội dung mô tả của biểu mẫu.
getDestinationId()StringLấy mã đích đến cho phản hồi của biểu mẫu.
getDestinationType()DestinationTypeLấy kiểu đích đến phản hồi của biểu mẫu.
getEditUrl()StringLấy URL có thể dùng để truy cập vào chế độ chỉnh sửa của biểu mẫu.
getEditors()User[]Lấy danh sách người chỉnh sửa cho Form này.
getId()StringLấy mã nhận dạng của biểu mẫu.
getItemById(id)ItemLấy mục có mã nhận dạng nhất định.
getItems()Item[]Lấy một mảng gồm tất cả các mục trong biểu mẫu.
getItems(itemType)Item[]Lấy một mảng gồm tất cả các mặt hàng thuộc một loại nhất định.
getPublishedUrl()StringLấy URL có thể dùng để phản hồi biểu mẫu.
getResponse(responseId)FormResponseNhận một phản hồi qua biểu mẫu dựa trên mã phản hồi tương ứng.
getResponses()FormResponse[]Lấy một loạt gồm tất cả phản hồi của biểu mẫu.
getResponses(timestamp)FormResponse[]Nhận một loạt tất cả các phản hồi của biểu mẫu sau một ngày và giờ nhất định.
getShuffleQuestions()BooleanXác định xem thứ tự các câu hỏi trên mỗi trang của biểu mẫu có được sắp xếp ngẫu nhiên hay không.
getSummaryUrl()StringLấy URL có thể dùng để xem bản tóm tắt phản hồi của biểu mẫu.
getTitle()StringLấy tiêu đề của biểu mẫu.
hasLimitOneResponsePerUser()BooleanXác định xem biểu mẫu có chỉ cho phép một câu trả lời cho mỗi người trả lời hay không.
hasProgressBar()BooleanXác định xem biểu mẫu có hiển thị thanh tiến trình hay không.
hasRespondAgainLink()BooleanXác định xem biểu mẫu có hiển thị đường liên kết để gửi một phản hồi khác sau khi người trả lời hoàn tất biểu mẫu hay không.
isAcceptingResponses()BooleanXác định xem biểu mẫu hiện có chấp nhận phản hồi hay không.
isPublishingSummary()BooleanXác định xem biểu mẫu có hiển thị đường liên kết để xem bản tóm tắt câu trả lời sau khi người trả lời hoàn tất biểu mẫu hay không.
isQuiz()BooleanXác định xem biểu mẫu có phải là bài kiểm tra hay không.
moveItem(from, to)ItemDi chuyển một mục tại một chỉ mục nhất định trong số tất cả các mục trong biểu mẫu sang một chỉ mục nhất định khác.
moveItem(item, toIndex)ItemDi chuyển một mục nhất định tới một chỉ mục nhất định trong số tất cả các mục trong biểu mẫu.
removeDestination()FormHuỷ liên kết biểu mẫu khỏi đích đến hiện tại cho câu trả lời.
removeEditor(emailAddress)FormXoá người dùng cụ thể khỏi danh sách người chỉnh sửa của Form.
removeEditor(user)FormXoá người dùng cụ thể khỏi danh sách người chỉnh sửa của Form.
requiresLogin()BooleanXác định xem biểu mẫu có yêu cầu người trả lời đăng nhập vào tài khoản trong cùng một miền hay miền con trước khi trả lời hay không.
setAcceptingResponses(enabled)FormThiết lập xem biểu mẫu có chấp nhận phản hồi hay không.
setAllowResponseEdits(enabled)FormThiết lập xem biểu mẫu có hiển thị liên kết để chỉnh sửa phản hồi sau khi gửi hay không.
setCollectEmail(collect)FormĐặt xem biểu mẫu có thu thập địa chỉ email của người trả lời hay không.
setConfirmationMessage(message)FormĐặt thông báo xác nhận cho biểu mẫu.
setCustomClosedFormMessage(message)FormĐặt thông báo hiển thị nếu biểu mẫu không chấp nhận phản hồi.
setDescription(description)FormĐặt nội dung mô tả cho biểu mẫu.
setDestination(type, id)FormĐặt đích đến nơi câu trả lời trong biểu mẫu được lưu.
setIsQuiz(enabled)FormThiết lập xem biểu mẫu có phải là bài kiểm tra hay không.
setLimitOneResponsePerUser(enabled)FormThiết lập có cho phép biểu mẫu chỉ cho phép một câu trả lời cho mỗi người trả lời hay không.
setProgressBar(enabled)FormThiết lập xem biểu mẫu có thanh tiến trình hay không.
setPublishingSummary(enabled)FormĐặt xem biểu mẫu có hiển thị đường liên kết để xem bản tóm tắt câu trả lời sau khi người trả lời gửi biểu mẫu hay không.
setRequireLogin(requireLogin)FormThiết lập xem biểu mẫu có yêu cầu người trả lời đăng nhập vào một tài khoản trong cùng một miền hoặc một miền con trước khi phản hồi hay không.
setShowLinkToRespondAgain(enabled)FormThiết lập xem biểu mẫu có hiển thị đường liên kết để gửi một phản hồi khác sau khi người trả lời hoàn tất biểu mẫu hay không.
setShuffleQuestions(shuffle)FormThiết lập liệu thứ tự của các câu hỏi trên mỗi trang của biểu mẫu có được ngẫu nhiên hay không.
setTitle(title)FormĐặt tiêu đề cho biểu mẫu.
shortenFormUrl(url)StringChuyển đổi URL dài cho một biểu mẫu thành URL ngắn.
submitGrades(responses)FormGửi điểm cho các formResponses được nêu.

Tài liệu chi tiết

addCheckboxGridItem()

Thêm một mục câu hỏi mới (được trình bày dưới dạng lưới gồm các cột và hàng) cho phép người trả lời chọn nhiều lựa chọn cho mỗi hàng trong một chuỗi các hộp đánh dấu.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a checkbox grid item.
const item = form.addCheckboxGridItem();

// Sets the title 'Where did you celebrate New Year's?'
item.setTitle('Where did you celebrate New Year's?');

// Sets the grid's rows and columns.
item.setRows(['New York', 'San Francisco', 'London'])
  .setColumns(['2014', '2015', '2016', '2017']);

Cầu thủ trả bóng

CheckboxGridItem – Mục mới tạo.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addCheckboxItem()

Thêm một mục câu hỏi mới cho phép người trả lời chọn một hoặc nhiều hộp đánh dấu, cũng như trường "other" (không bắt buộc).

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a checkbox item.
const item = form.addCheckboxItem();

// Sets the title of the checkbox item to 'Do you prefer cats or dogs?'
item.setTitle('Do you prefer cats or dogs?');

// Sets the choices.
item.setChoiceValues(['Cats', 'Dogs']);

Cầu thủ trả bóng

CheckboxItem – Mục mới tạo.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addDateItem()

Thêm một mục mới cho câu hỏi để người trả lời có thể cho biết ngày.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a date item.
const item = form.addDateItem();

// Sets the title to 'When were you born?'
item.setTitle('When were you born?');

// Sets the description for the date item.
item.setHelpText('Some helper text.');

Cầu thủ trả bóng

DateItem – Mục mới tạo.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addDateTimeItem()

Thêm một mục mới cho câu hỏi để người trả lời có thể cho biết ngày và giờ.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a question with date and time inputs.
const item = form.addDateTimeItem();

// Sets the title to 'When were you born?'
item.setTitle('When were you born?');

// Sets the question as required.
item.setRequired(true);

Cầu thủ trả bóng

DateTimeItem – Mục mới tạo.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addDurationItem()

Thêm một mục câu hỏi mới cho phép người trả lời nêu rõ khoảng thời gian.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a question with a duration input.
const item = form.addDurationItem();

// Sets the title to 'How long can you hold your breath?'
item.setTitle('How long can you hold your breath?');

// Sets the question as required.
item.setRequired(true);

Cầu thủ trả bóng

DurationItem – Mục mới tạo.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addEditor(emailAddress)

Thêm người dùng đã cho vào danh sách người chỉnh sửa của Form. Nếu người dùng đã có trong danh sách người xem, phương thức này sẽ đẩy người dùng ra khỏi danh sách người xem.

Các tham số

TênLoạiNội dung mô tả
emailAddressStringĐịa chỉ email của người dùng cần thêm.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addEditor(user)

Thêm người dùng đã cho vào danh sách người chỉnh sửa của Form. Nếu người dùng đã có trong danh sách người xem, phương thức này sẽ đẩy người dùng ra khỏi danh sách người xem.

Các tham số

TênLoạiNội dung mô tả
userUserĐại diện cho người dùng mà bạn cần thêm.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addEditors(emailAddresses)

Thêm mảng người dùng đã cho vào danh sách trình chỉnh sửa của Form. Nếu bất kỳ người dùng nào đã có trong danh sách người xem, phương thức này sẽ thăng hạng họ ra khỏi danh sách người xem.

Các tham số

TênLoạiNội dung mô tả
emailAddressesString[]Một mảng địa chỉ email của người dùng cần thêm.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addGridItem()

Thêm một mục câu hỏi mới (được trình bày dưới dạng lưới gồm các cột và hàng) cho phép người trả lời chọn một lựa chọn cho mỗi hàng trong một chuỗi các nút chọn.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a multiple choice grid.
const item = form.addGridItem();

// Sets the title to 'Rate your interests.'
item.setTitle('Rate your interests');

// Sets the grid's rows and columns.
item.setRows(['Cars', 'Computers', 'Celebrities'])
  .setColumns(['Boring', 'So-so', 'Interesting']);

Cầu thủ trả bóng

GridItem – Mục mới tạo.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addImageItem()

Thêm một mục bố cục mới có hiển thị hình ảnh.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds an image item.
const item = form.addImageItem();

// Gets the Google icon to use as the image.
const img = UrlFetchApp.fetch('https://fonts.gstatic.com/s/i/productlogos/googleg/v6/web-24dp/logo_googleg_color_1x_web_24dp.png');

// Sets the image, title, and description for the item.
item.setTitle('Google icon').setHelpText('Google icon').setImage(img);

Cầu thủ trả bóng

ImageItem – Mục mới tạo.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addListItem()

Thêm một mục câu hỏi mới cho phép người trả lời chọn một câu trả lời trong danh sách thả xuống.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a dropdown list to the form.
const item = form.addListItem();

// Sets the title to 'Do you prefer cats or dogs?'
item.setTitle('Do you prefer cats or dogs?');

// Sets the description to 'This is description text...'
item.setHelpText('This is description text...');

// Creates and adds choices to the dropdown list.
item.setChoices([
  item.createChoice('dog'),
  item.createChoice('cat')
]);

Cầu thủ trả bóng

ListItem – Mục mới tạo.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addMultipleChoiceItem()

Thêm một mục câu hỏi mới cho phép người trả lời chọn một lựa chọn trong danh sách các nút chọn hoặc trường "khác" (không bắt buộc).

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a multiple choice item to the form.
const item = form.addMultipleChoiceItem();

// Sets the title.
item.setTitle('What is your favorite ice cream flavor?');

// Creates some choice items.
const vanilla = item.createChoice('vanilla');
const chocolate = item.createChoice('chocolate');
const strawberry = item.createChoice('strawberry');

// Sets the choices.
item.setChoices([vanilla, chocolate, strawberry]);

Cầu thủ trả bóng

MultipleChoiceItem – Mục mới tạo.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addPageBreakItem()

Thêm một mục bố cục mới đánh dấu phần đầu của một trang.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds page break items to create a second and third page for the form.
const pageTwo = form.addPageBreakItem();
const pageThree = form.addPageBreakItem();

// Sets the titles for the pages.
pageTwo.setTitle('Page two');
pageThree.setTitle('Page three');

// Upon completion of the first page, sets the form to navigate to the third page.
pageTwo.setGoToPage(pageThree);

// Upon completion of the second page, sets the form to navigate back to the first page.
pageThree.setGoToPage(FormApp.PageNavigationType.RESTART);

Cầu thủ trả bóng

PageBreakItem – Mục mới tạo.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addParagraphTextItem()

Thêm một mục câu hỏi mới để người trả lời có thể nhập một khối văn bản.

// Opens the form by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds the paragraph text item.
const item = form.addParagraphTextItem();

// Sets the title to 'What is your address?'
item.setTitle('What is your address?');

Cầu thủ trả bóng

ParagraphTextItem – Mục mới tạo.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addScaleItem()

Thêm một mục câu hỏi mới cho phép người trả lời chọn một đáp án trong một chuỗi các nút chọn được đánh số.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds the scale item.
const item = form.addScaleItem();

// Sets the title of the scale item to 'Choose a number.'
item.setTitle('Choose a number');

// Sets the scale to 1-5.
item.setBounds(1, 5);

// Sets the label for the lower and upper bounds.
item.setLabels('Lowest', 'Highest');

Cầu thủ trả bóng

ScaleItem – Mục mới tạo.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addSectionHeaderItem()

Thêm một mục bố cục mới cho biết phần đầu của một phần (một cách trực quan).

 // Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds the section heading item.
const item = form.addSectionHeaderItem();

// Sets the title to 'Title of new section.'
item.setTitle('Title of new section');

// Sets the description.
item.setHelpText('Description of new section');

Cầu thủ trả bóng

SectionHeaderItem – Mục mới tạo.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addTextItem()

Thêm một mục câu hỏi mới để người trả lời nhập một dòng văn bản.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a single-line text item.
const item = form.addTextItem();

// Sets the title to 'What is your name?'
item.setTitle('What is your name?');

Cầu thủ trả bóng

TextItem – Mục mới tạo.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addTimeItem()

Thêm một mục câu hỏi mới cho phép người trả lời chỉ rõ thời gian trong ngày.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a question with a time input.
const item = form.addTimeItem();

// Sets the title to 'What time do you usually wake up in the morning?'
item.setTitle('What time do you usually wake up in the morning?');

Cầu thủ trả bóng

TimeItem – Mục mới tạo.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addVideoItem()

Thêm một mục bố cục mới sẽ hiển thị video.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a video item.
const item = form.addVideoItem();

// Sets the title, description, and video.
item.setTitle('YouTube video')
  .setHelpText('Send content automatically via Google Sheets and Apps Script')
  .setVideoUrl('https://youtu.be/xxgQr-jSu9o');

// Sets the alignment to the center.
item.setAlignment(FormApp.Alignment.CENTER);

Cầu thủ trả bóng

VideoItem – Mục mới tạo.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

canEditResponse()

Xác định xem biểu mẫu có hiển thị đường liên kết để chỉnh sửa câu trả lời sau khi gửi hay không.

Bất kể chế độ cài đặt này như thế nào, phương thức FormResponse.getEditResponseUrl() đều cho phép tác giả tập lệnh có quyền chỉnh sửa biểu mẫu tạo một URL có thể dùng để chỉnh sửa phản hồi.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Checks if the form displays a link to edit a response after submitting it.
// The default is false. To let people edit their responses, use
// form.setAllowResponseEdits(true).
const edit = form.canEditResponse();

// If the form doesn't let people edit responses, logs false to the console.
console.log(edit);

Cầu thủ trả bóng

Booleantrue nếu biểu mẫu hiển thị đường liên kết "Chỉnh sửa câu trả lời của bạn"; false nếu không có.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

collectsEmail()

Xác định xem biểu mẫu có thu thập địa chỉ email của người trả lời hay không.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to not collect respondents' email addresses.
form.setCollectEmail(false);

// Checks whether the form collects respondents' email addresses and logs it to the console.
const bool = form.collectsEmail();

console.log(bool);

Cầu thủ trả bóng

Booleantrue nếu biểu mẫu thu thập địa chỉ email; false nếu biểu mẫu không thu thập.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

createResponse()

Tạo phản hồi mới cho biểu mẫu. Để trả lời một mục câu hỏi, hãy tạo một ItemResponse từ mục đó rồi đính kèm vào câu trả lời biểu mẫu này bằng cách gọi FormResponse.withItemResponse(response). Để lưu câu trả lời đã tập hợp, hãy gọi FormResponse.submit().

Cầu thủ trả bóng

FormResponse – Phản hồi qua biểu mẫu mới được tạo.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

deleteAllResponses()

Xoá tất cả câu trả lời đã gửi khỏi kho câu trả lời của biểu mẫu. Phương thức này không xoá các bản sao của câu trả lời được lưu trữ ở đích đến phản hồi bên ngoài (như bảng tính), nhưng sẽ xoá chế độ xem tóm tắt của biểu mẫu.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

deleteItem(index)

Xoá mục tại chỉ mục đã cho trong số tất cả các mục trong biểu mẫu. Gửi một trường hợp ngoại lệ cho tập lệnh nếu không có mục nào tồn tại ở chỉ mục đã cho.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets all the items from the form.
const items = form.getItems();

// Finds the index of a paragraph text item and deletes it by the item's index.
const index = items.findIndex(item => item.getType() === FormApp.ItemType.PARAGRAPH_TEXT);
if (index !== -1) {
  form.deleteItem(index);
}

Các tham số

TênLoạiNội dung mô tả
indexIntegerChỉ mục của mục trong số tất cả các mục trong biểu mẫu.

Gửi

Error — nếu không có mục nào tồn tại ở chỉ mục đã cho

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

deleteItem(item)

Xoá mục đã cho. Gửi một ngoại lệ cho tập lệnh nếu mục đã bị xoá.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets all of the items from the form.
const items = form.getItems();

// Finds a paragraph text item and deletes it.
const item = items.find(item => item.getType() === FormApp.ItemType.PARAGRAPH_TEXT);
if (item) {
  form.deleteItem(item);
}

Các tham số

TênLoạiNội dung mô tả
itemItemMục cần xoá.

Gửi

Error — nếu mục không tồn tại trong biểu mẫu

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

deleteResponse(responseId)

Xoá một câu trả lời khỏi kho câu trả lời của biểu mẫu. Phương thức này không xoá bản sao của các phản hồi được lưu trữ ở đích đến phản hồi bên ngoài (như bảng tính), nhưng sẽ xoá phản hồi đó khỏi khung hiển thị tóm tắt của biểu mẫu. Bạn có thể truy xuất mã phản hồi bằng FormResponse.getId().

Các tham số

TênLoạiNội dung mô tả
responseIdStringMã của câu trả lời trong biểu mẫu cần xoá.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getConfirmationMessage()

Nhận thông báo xác nhận của biểu mẫu.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the confirmation message to display after someone submits the form.
form.setConfirmationMessage('You successfully submitted the form.');

// Gets the confirmation message and logs it to the console.
const message = form.getConfirmationMessage();

console.log(message);

Cầu thủ trả bóng

String — Thông báo xác nhận của biểu mẫu.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getCustomClosedFormMessage()

Lấy thông báo tuỳ chỉnh hiển thị nếu biểu mẫu không chấp nhận phản hồi, hoặc một chuỗi trống nếu không có thông báo tuỳ chỉnh nào được đặt.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets a custom closed form message to display to the user when the form
// no longer accepts responses.
form.setCustomClosedFormMessage('The form is no longer accepting responses.');

// Gets the custom message set for the form and logs it to the console.
const message = form.getCustomClosedFormMessage();

console.log(message);

Cầu thủ trả bóng

String – Thông báo tuỳ chỉnh sẽ hiển thị nếu biểu mẫu không chấp nhận phản hồi, hoặc là một chuỗi trống nếu không đặt thông báo tuỳ chỉnh nào.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getDescription()

Lấy nội dung mô tả của biểu mẫu.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form description.
form.setDescription('This is the form description.');

// Gets the form description and logs it to the console.
const description = form.getDescription();

console.log(description);

Cầu thủ trả bóng

String — Nội dung mô tả của biểu mẫu.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getDestinationId()

Lấy mã đích đến cho phản hồi của biểu mẫu.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Creates a spreadsheet to use as the response destination.
const ss = SpreadsheetApp.create('Test_Spreadsheet');

// Updates the form's response destination.
form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());

// Gets the ID of the form's response destination and logs it to the console.
const destinationId = form.getDestinationId();

console.log(destinationId);

Cầu thủ trả bóng

String – Mã đích đến cho phản hồi của biểu mẫu.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getDestinationType()

Lấy kiểu đích đến phản hồi của biểu mẫu.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc1234556/edit');

// Gets the type of the form's response destination and logs it to the console.
const destinationType = form.getDestinationType().name();

console.log(destinationType);

Cầu thủ trả bóng

DestinationType – Loại đích đến cho phản hồi của biểu mẫu.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getEditUrl()

Lấy URL có thể dùng để truy cập vào chế độ chỉnh sửa của biểu mẫu.

// Opens the form by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the URL that accesses the form's edit mode and logs it to the console.
const url = form.getEditUrl();

console.log(url);

Cầu thủ trả bóng

String – URL cần chỉnh sửa biểu mẫu.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getEditors()

Lấy danh sách người chỉnh sửa cho Form này.

Cầu thủ trả bóng

User[] – Một mảng người dùng có quyền chỉnh sửa.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getId()

Lấy mã nhận dạng của biểu mẫu.

// Opens the form by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the ID of the form and logs it to the console.
const id = form.getId();

console.log(id);

Cầu thủ trả bóng

String – Mã của biểu mẫu.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getItemById(id)

Lấy mục có mã nhận dạng nhất định. Trả về null nếu mã nhận dạng không tương ứng với một mục trong biểu mẫu.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the ID of the first item on the form.
const itemId = form.getItems()[0].getId();

// Gets the item from the ID.
const item = form.getItemById(itemId);

// Gets the name of the item type and logs it to the console.
const type = item.getType().name();

console.log(type);

Các tham số

TênLoạiNội dung mô tả
idIntegerMã nhận dạng của mặt hàng.

Cầu thủ trả bóng

Item – Mục có mã nhận dạng cho trước, hoặc null nếu mục đó không tồn tại trong biểu mẫu.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getItems()

Lấy một mảng gồm tất cả các mục trong biểu mẫu.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the list of items in the form.
const items = form.getItems();

// Gets the type for each item and logs them to the console.
const types = items.map((item) => item.getType().name());

console.log(types);

Cầu thủ trả bóng

Item[] – Một mảng gồm tất cả các mục trong biểu mẫu.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getItems(itemType)

Lấy một mảng gồm tất cả các mặt hàng thuộc một loại nhất định.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets a list of all checkbox items on the form.
const items = form.getItems(FormApp.ItemType.CHECKBOX);

// Gets the title of each checkbox item and logs them to the console.
const checkboxItemsTitle = items.map((item) => item.asCheckboxItem().getTitle());
console.log(checkboxItemsTitle);

Các tham số

TênLoạiNội dung mô tả
itemTypeItemTypeLoại mục cần truy xuất.

Cầu thủ trả bóng

Item[] – Một mảng gồm tất cả các mục thuộc loại đó.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getPublishedUrl()

Lấy URL có thể dùng để phản hồi biểu mẫu.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the URL to respond to the form and logs it to the console.
const url = form.getPublishedUrl();
console.log(url);

Cầu thủ trả bóng

String – URL để phản hồi biểu mẫu.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getResponse(responseId)

Nhận một phản hồi qua biểu mẫu dựa trên mã phản hồi tương ứng. Bạn có thể truy xuất mã phản hồi từ FormResponse.getId().

Các tham số

TênLoạiNội dung mô tả
responseIdStringMã cho câu trả lời qua biểu mẫu.

Cầu thủ trả bóng

FormResponse – Câu trả lời trong biểu mẫu.

Gửi

Error – nếu câu trả lời không tồn tại

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getResponses()

Lấy một loạt gồm tất cả phản hồi của biểu mẫu.

Cầu thủ trả bóng

FormResponse[] – Một mảng gồm tất cả phản hồi của biểu mẫu.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getResponses(timestamp)

Nhận một loạt tất cả các phản hồi của biểu mẫu sau một ngày và giờ nhất định.

Các tham số

TênLoạiNội dung mô tả
timestampDateNgày và giờ sớm nhất mà các câu trả lời trong biểu mẫu sẽ được trả về.

Cầu thủ trả bóng

FormResponse[] – Danh sách câu trả lời qua biểu mẫu.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getShuffleQuestions()

Xác định xem thứ tự các câu hỏi trên mỗi trang của biểu mẫu có được sắp xếp ngẫu nhiên hay không.

Cầu thủ trả bóng

Booleantrue nếu thứ tự các câu hỏi trên mỗi trang của biểu mẫu là ngẫu nhiên; false nếu không.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getSummaryUrl()

Lấy URL có thể dùng để xem bản tóm tắt phản hồi của biểu mẫu. Trừ phi bạn đặt setPublishingSummary(enabled) thành true, chỉ người dùng có quyền chỉnh sửa biểu mẫu mới có thể truy cập URL.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// Opens the form by its URL.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the URL to view a summary of the form's responses and logs it to the console.
const url = form.getSummaryUrl();
console.log(url);

Cầu thủ trả bóng

String – URL để xem bản tóm tắt câu trả lời.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getTitle()

Lấy tiêu đề của biểu mẫu.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the title of the form to 'For_Testing.'
form.setTitle('For_Testing');

// Gets the title of the form and logs it to the console.
const title = form.getTitle();
console.log(title);

Cầu thủ trả bóng

String — Tiêu đề của biểu mẫu.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

hasLimitOneResponsePerUser()

Xác định xem biểu mẫu có chỉ cho phép một câu trả lời cho mỗi người trả lời hay không. Nếu giá trị là true thì tập lệnh sẽ không thể gửi câu trả lời qua biểu mẫu.

Cầu thủ trả bóng

Booleantrue nếu biểu mẫu chỉ cho phép mỗi người trả lời một câu trả lời; false nếu không thể.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

hasProgressBar()

Xác định xem biểu mẫu có hiển thị thanh tiến trình hay không.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// Opens the form by its URL.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Displays the progress bar on the form.
form.setProgressBar(true);

// Checks if the form displays a progress bar and logs it to the console.
console.log(form.hasProgressBar());

Cầu thủ trả bóng

Booleantrue nếu biểu mẫu hiển thị thanh tiến trình; false nếu không hiển thị.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

Xác định xem biểu mẫu có hiển thị đường liên kết để gửi một phản hồi khác sau khi người trả lời hoàn tất biểu mẫu hay không.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to display a link to submit another
// response after someone submits the form.
form.setShowLinkToRespondAgain(true);

// Checks if the form displays a 'Submit another response' link and logs it to the console.
console.log(form.hasRespondAgainLink());

Cầu thủ trả bóng

Booleantrue nếu biểu mẫu hiển thị đường liên kết "Gửi câu trả lời khác"; false nếu không.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

isAcceptingResponses()

Xác định xem biểu mẫu hiện có chấp nhận phản hồi hay không.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to accept responses.
form.setAcceptingResponses(true);

// Checks if the form is accepting responses or not and logs it to the console.
const accepting = form.isAcceptingResponses();
console.log(accepting);

Cầu thủ trả bóng

Booleantrue nếu biểu mẫu chấp nhận phản hồi; false nếu không chấp nhận.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

isPublishingSummary()

Xác định xem biểu mẫu có hiển thị đường liên kết để xem bản tóm tắt câu trả lời sau khi người trả lời hoàn tất biểu mẫu hay không.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to display a link to a summary of
// the responses after someone submits the form.
form.setPublishingSummary(true);

// Checks if the form displays a "See previous responses" link and logs it to the console.
const publishingLink = form.isPublishingSummary();
console.log(publishingLink);

Cầu thủ trả bóng

Booleantrue nếu biểu mẫu hiển thị đường liên kết "Xem câu trả lời trước đó"; false nếu không thấy.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

isQuiz()

Xác định xem biểu mẫu có phải là bài kiểm tra hay không.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form as a quiz.
form.setIsQuiz(true);

// Checks if the form is a quiz or not and logs it to the console.
console.log(form.isQuiz());

Cầu thủ trả bóng

Booleantrue nếu biểu mẫu chấp nhận phản hồi; false nếu không chấp nhận.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

moveItem(from, to)

Di chuyển một mục tại một chỉ mục nhất định trong số tất cả các mục trong biểu mẫu sang một chỉ mục nhất định khác. Gửi một trường hợp ngoại lệ về tập lệnh nếu chỉ mục to nằm ngoài giới hạn.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Moves the first item to be the last item.
form.moveItem(0, form.getItems().length - 1);

Các tham số

TênLoạiNội dung mô tả
fromIntegerChỉ mục hiện tại của mục trong số tất cả các mục trong biểu mẫu.
toIntegerChỉ mục mới cho mục trong số tất cả các mục trong biểu mẫu.

Cầu thủ trả bóng

Item – Mục đã được di chuyển.

Gửi

Error – nếu một trong hai chỉ mục nằm ngoài giới hạn.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

moveItem(item, toIndex)

Di chuyển một mục nhất định tới một chỉ mục nhất định trong số tất cả các mục trong biểu mẫu. Gửi một trường hợp ngoại lệ về tập lệnh nếu chỉ mục đã cho nằm ngoài giới hạn.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the first item.
const item = form.getItems()[0];

// Moves the item to be the last item.
form.moveItem(item, form.getItems().length - 1);

Các tham số

TênLoạiNội dung mô tả
itemItemMục cần di chuyển.
toIndexIntegerChỉ mục mới cho mục trong số tất cả các mục trong biểu mẫu.

Cầu thủ trả bóng

Item – Mục đã được di chuyển.

Gửi

Error – nếu chỉ mục nằm ngoài giới hạn.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

removeDestination()

Huỷ liên kết biểu mẫu khỏi đích đến hiện tại cho câu trả lời. Đích đến cũ đã bị huỷ liên kết vẫn giữ bản sao của tất cả các phản hồi trước đó. Tất cả biểu mẫu, bao gồm cả những biểu mẫu không được đặt đích đến rõ ràng, hãy lưu một bản sao phản hồi trong kho phản hồi của biểu mẫu. Nếu biểu mẫu hiện không có đích đến phản hồi, thì phương thức này sẽ không có hiệu lực.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Opens a spreadsheet to use for the response destination.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit');

// Updates the form's response destination to the spreadsheet.
form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());

// Unlinks the form from the spreadsheet.
form.removeDestination();

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

removeEditor(emailAddress)

Xoá người dùng cụ thể khỏi danh sách người chỉnh sửa của Form. Phương thức này không chặn người dùng truy cập vào Form nếu họ thuộc một lớp người dùng có quyền truy cập chung, ví dụ: nếu Form được chia sẻ với toàn bộ miền của người dùng hoặc nếu Form nằm trong bộ nhớ dùng chung mà người dùng có thể truy cập.

Đối với các tệp trên Drive, thao tác này cũng sẽ xoá người dùng khỏi danh sách người xem.

Các tham số

TênLoạiNội dung mô tả
emailAddressStringĐịa chỉ email của người dùng cần xoá.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

removeEditor(user)

Xoá người dùng cụ thể khỏi danh sách người chỉnh sửa của Form. Phương thức này không chặn người dùng truy cập vào Form nếu họ thuộc một lớp người dùng có quyền truy cập chung, ví dụ: nếu Form được chia sẻ với toàn bộ miền của người dùng hoặc nếu Form nằm trong bộ nhớ dùng chung mà người dùng có thể truy cập.

Đối với các tệp trên Drive, thao tác này cũng sẽ xoá người dùng khỏi danh sách người xem.

Các tham số

TênLoạiNội dung mô tả
userUserBiểu thị người dùng cần xoá.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

requiresLogin()

Xác định xem biểu mẫu có yêu cầu người trả lời đăng nhập vào tài khoản trong cùng một miền hay miền con trước khi trả lời hay không.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Checks if the form requires respondents to log in to a Google Workspace account
// before responding and logs it to the console.
const login = form.requiresLogin();
console.log(login);

Cầu thủ trả bóng

Booleantrue nếu biểu mẫu yêu cầu người dùng đăng nhập; false nếu không yêu cầu.


setAcceptingResponses(enabled)

Thiết lập xem biểu mẫu có chấp nhận phản hồi hay không. Tuỳ chọn mặc định cho các biểu mẫu mới là true.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to accept responses.
form.setAcceptingResponses(true);

// Checks whether the form is accepting responses or not and logs it to the console.
console.log(form.isAcceptingResponses());

Các tham số

TênLoạiNội dung mô tả
enabledBooleantrue nếu biểu mẫu chấp nhận phản hồi; false nếu biểu mẫu không chấp nhận phản hồi.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setAllowResponseEdits(enabled)

Thiết lập xem biểu mẫu có hiển thị liên kết để chỉnh sửa phản hồi sau khi gửi hay không. Tuỳ chọn mặc định cho các biểu mẫu mới là false.

Bất kể chế độ cài đặt này như thế nào, phương thức FormResponse.getEditResponseUrl() đều cho phép tác giả tập lệnh có quyền chỉnh sửa biểu mẫu tạo một URL có thể dùng để chỉnh sửa phản hồi.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Shows "Edit your response" link after someone submits the form.
form.setAllowResponseEdits(true);

// Checks whether the option to edit the form after a user submits it is set to true or not
// and logs it to the console.
console.log(form.canEditResponse());

Các tham số

TênLoạiNội dung mô tả
enabledBooleantrue nếu biểu mẫu hiển thị đường liên kết "Chỉnh sửa câu trả lời của bạn"; false nếu không.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setCollectEmail(collect)

Đặt xem biểu mẫu có thu thập địa chỉ email của người trả lời hay không. Tuỳ chọn mặc định cho các biểu mẫu mới là false.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to collect respondents' email addresses.
form.setCollectEmail(true);

// Checks whether the value is set to true or false and logs it to the console.
const collect = form.collectsEmail();
console.log(collect);

Các tham số

TênLoạiNội dung mô tả
collectBooleantrue nếu biểu mẫu thu thập địa chỉ email; false nếu biểu mẫu không thu thập được.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setConfirmationMessage(message)

Đặt thông báo xác nhận cho biểu mẫu.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets a custom confirmation message to display after someone submits the form.
form.setConfirmationMessage('Your form has been successfully submitted.');

// Gets the confirmation message set for the form and logs it to the console.
const message = form.getConfirmationMessage();
console.log(message);

Các tham số

TênLoạiNội dung mô tả
messageStringThông báo xác nhận mới của biểu mẫu.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setCustomClosedFormMessage(message)

Đặt thông báo hiển thị nếu biểu mẫu không chấp nhận phản hồi. Nếu bạn không đặt thông báo nào, biểu mẫu sẽ sử dụng thông báo mặc định.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to not accept responses.
form.setAcceptingResponses(false);

// Sets a custom closed form message to display to the user.
form.setCustomClosedFormMessage('The form is no longer accepting responses.');

// Gets the custom message set for the form and logs it to the console.
const message = form.getCustomClosedFormMessage();
console.log(message);

Các tham số

TênLoạiNội dung mô tả
messageStringThông báo sẽ hiển thị nếu biểu mẫu không chấp nhận phản hồi.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setDescription(description)

Đặt nội dung mô tả cho biểu mẫu.

Các tham số

TênLoạiNội dung mô tả
descriptionStringNội dung mô tả mới của biểu mẫu.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setDestination(type, id)

Đặt đích đến nơi câu trả lời trong biểu mẫu được lưu. Tất cả các biểu mẫu, bao gồm cả những biểu mẫu không có đích đến được đặt rõ ràng, hãy lưu một bản sao của các phản hồi trong kho phản hồi của biểu mẫu.

Các tham số

TênLoạiNội dung mô tả
typeDestinationTypeLoại đích đến phản hồi của biểu mẫu.
idStringMã đích đến cho phản hồi của biểu mẫu.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Gửi

Error — nếu mã đích đến đã cho không hợp lệ

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setIsQuiz(enabled)

Thiết lập xem biểu mẫu có phải là bài kiểm tra hay không. Tuỳ chọn mặc định cho các biểu mẫu mới là false.

Chỉ cho phép sử dụng câu hỏi đã chấm điểm trong Bài kiểm tra. Vì vậy, khi bạn đặt giá trị này thành false, mọi tuỳ chọn chấm điểm sẽ bị xoá khỏi tất cả các câu hỏi.

Chế độ cài đặt Bài kiểm tra chỉ có trong giao diện người dùng mới của Biểu mẫu. Khi bạn tạo biểu mẫu, Bài kiểm tra sẽ chọn sử dụng giao diện người dùng mới cho biểu mẫu.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Makes the form a quiz.
form.setIsQuiz(true);

// Checks whether the form is a quiz or not and logs it to the console.
console.log(form.isQuiz());

Các tham số

TênLoạiNội dung mô tả
enabledBooleantrue nếu cần bật tính năng bài kiểm tra cho biểu mẫu; false nếu không.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setLimitOneResponsePerUser(enabled)

Thiết lập có cho phép biểu mẫu chỉ cho phép một câu trả lời cho mỗi người trả lời hay không. Tuỳ chọn mặc định cho các biểu mẫu mới là false. Nếu bạn đặt giá trị thành true, tập lệnh sẽ hoàn toàn không thể gửi câu trả lời qua biểu mẫu.

Các tham số

TênLoạiNội dung mô tả
enabledBooleantrue nếu biểu mẫu chỉ cho phép mỗi người trả lời một câu trả lời; false nếu không cho phép.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setProgressBar(enabled)

Thiết lập xem biểu mẫu có thanh tiến trình hay không. Tuỳ chọn mặc định cho các biểu mẫu mới là false.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Displays the progress bar on the form.
form.setProgressBar(true);

// Checks whether the form has a progress bar and logs it to the console.
console.log(form.hasProgressBar());

Các tham số

TênLoạiNội dung mô tả
enabledBooleantrue nếu biểu mẫu hiển thị thanh tiến trình; false nếu không hiển thị.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setPublishingSummary(enabled)

Đặt xem biểu mẫu có hiển thị đường liên kết để xem bản tóm tắt câu trả lời sau khi người trả lời gửi biểu mẫu hay không. Tuỳ chọn mặc định cho các biểu mẫu mới là false.

Các tham số

TênLoạiNội dung mô tả
enabledBooleantrue nếu biểu mẫu hiển thị đường liên kết "Xem các câu trả lời trước đó"; false nếu không.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setRequireLogin(requireLogin)

Thiết lập xem biểu mẫu có yêu cầu người trả lời đăng nhập vào một tài khoản trong cùng một miền hoặc một miền con trước khi phản hồi hay không. Chế độ mặc định cho các biểu mẫu mới là false trừ phi quản trị viên miền thay đổi giá trị mặc định.

Tính năng này chỉ dành cho những biểu mẫu do người dùng Google Workspace tạo. Bạn không thể yêu cầu người dùng sử dụng các loại Tài khoản Google khác để đăng nhập.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form so that users must log in to their Google Workspace account.
form.setRequireLogin(true);

// Checks whether the form requires login or not and logs it to the console.
console.log(form.requiresLogin());

Các tham số

TênLoạiNội dung mô tả
requireLoginBooleantrue nếu biểu mẫu yêu cầu người dùng đăng nhập; false nếu không thể.

Cầu thủ trả bóng

Form – Dạng hiện tại (để tạo chuỗi).

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setShowLinkToRespondAgain(enabled)

Thiết lập xem biểu mẫu có hiển thị đường liên kết để gửi một phản hồi khác sau khi người trả lời hoàn tất biểu mẫu hay không. Tuỳ chọn mặc định cho các biểu mẫu mới là true.

Các tham số

TênLoạiNội dung mô tả
enabledBooleantrue nếu biểu mẫu hiển thị đường liên kết "Gửi câu trả lời khác"; false nếu không.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setShuffleQuestions(shuffle)

Thiết lập liệu thứ tự của các câu hỏi trên mỗi trang của biểu mẫu có được ngẫu nhiên hay không.

Các tham số

TênLoạiNội dung mô tả
shuffleBooleantrue nếu thứ tự của các câu hỏi trên mỗi trang của biểu mẫu nên được chọn ngẫu nhiên; false nếu không.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setTitle(title)

Đặt tiêu đề cho biểu mẫu.

Các tham số

TênLoạiNội dung mô tả
titleStringTiêu đề mới của biểu mẫu.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

shortenFormUrl(url)

Chuyển đổi URL dài cho một biểu mẫu thành URL ngắn. Gửi ngoại lệ nếu URL dài không thuộc Google Biểu mẫu.

Các tham số

TênLoạiNội dung mô tả
urlStringURL cần rút ngắn.

Cầu thủ trả bóng

String – URL ở dạng http://goo.gl/forms/1234.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

submitGrades(responses)

Gửi điểm cho các formResponses được nêu.

Nếu mã của bạn bao gồm trình kích hoạt onFormSubmit, thì việc gọi submitGrades() sẽ kích hoạt điều kiện onFormSubmit và tạo ra một vòng lặp vô hạn. Để tránh vòng lặp vô hạn, hãy thêm mã kiểm tra xem điểm đã tồn tại hay chưa trước khi gọi submitGrades().

Các tham số

TênLoạiNội dung mô tả
responsesFormResponse[]Một mảng gồm tất cả phản hồi của biểu mẫu.

Cầu thủ trả bóng

FormForm này, để tạo chuỗi.

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi sau:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms