Class Form

양식

전반적인 속성 및 항목이 포함된 양식 속성에는 제목, 설정, 응답이 저장되는 위치가 포함됩니다. 항목에는 체크박스나 라디오 항목과 같은 질문 항목이 포함되지만 레이아웃 항목은 페이지 나누기 등을 나타냅니다. 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());

방법

메서드반환 유형간략한 설명
addCheckboxGridItem()CheckboxGridItem열과 행의 그리드로 표시되는 새 질문 항목을 추가하여 응답자가 일련의 체크박스에서 행당 여러 선택 항목을 선택할 수 있도록 합니다.
addCheckboxItem()CheckboxItem응답자가 하나 이상의 체크박스를 선택할 수 있는 새 질문 항목과 선택사항인 '기타' 필드를 추가합니다.
addDateItem()DateItem응답자가 날짜를 표시할 수 있도록 새 질문 항목을 추가합니다.
addDateTimeItem()DateTimeItem응답자가 날짜와 시간을 표시할 수 있는 새 질문 항목을 추가합니다.
addDurationItem()DurationItem응답자가 기간을 표시할 수 있는 새 질문 항목을 추가합니다.
addEditor(emailAddress)Form지정된 사용자를 Form의 편집자 목록에 추가합니다.
addEditor(user)Form지정된 사용자를 Form의 편집자 목록에 추가합니다.
addEditors(emailAddresses)Form지정된 사용자 배열을 Form의 편집자 목록에 추가합니다.
addGridItem()GridItem새 질문 항목을 추가하고 열과 행의 그리드로 표시하여 응답자가 일련의 라디오 버튼에서 행당 하나의 선택 항목을 선택할 수 있도록 합니다.
addImageItem()ImageItem이미지를 표시하는 새 레이아웃 항목을 추가합니다.
addListItem()ListItem응답자가 드롭다운 목록에서 하나의 선택지를 선택할 수 있는 새 질문 항목을 추가합니다.
addMultipleChoiceItem()MultipleChoiceItem응답자가 라디오 버튼 목록이나 선택사항인 'other' 필드에서 한 가지 선택지를 선택할 수 있는 새 질문 항목을 추가합니다.
addPageBreakItem()PageBreakItem페이지의 시작을 표시하는 새 레이아웃 항목을 추가합니다.
addParagraphTextItem()ParagraphTextItem응답자가 텍스트 블록을 입력할 수 있는 새 질문 항목을 추가합니다.
addScaleItem()ScaleItem응답자가 번호가 매겨진 일련의 라디오 버튼 중에서 하나의 옵션을 선택할 수 있는 새 질문 항목을 추가합니다.
addSectionHeaderItem()SectionHeaderItem섹션의 시작을 시각적으로 나타내는 새 레이아웃 항목을 추가합니다.
addTextItem()TextItem응답자가 한 줄의 텍스트를 입력할 수 있는 새 질문 항목을 추가합니다.
addTimeItem()TimeItem응답자가 시간을 표시할 수 있는 새 질문 항목을 추가합니다.
addVideoItem()VideoItem동영상을 표시하는 새 레이아웃 항목을 추가합니다.
canEditResponse()Boolean응답을 제출한 후 응답을 수정할 수 있는 링크를 양식에 표시할지 결정합니다.
collectsEmail()Boolean양식에서 응답자의 이메일 주소를 수집할지 결정합니다.
createResponse()FormResponse양식에 대한 새 응답을 만듭니다.
deleteAllResponses()Form양식의 응답 저장소에서 제출된 모든 응답을 삭제합니다.
deleteItem(index)void양식의 모든 항목 중에서 지정된 색인에 있는 항목을 삭제합니다.
deleteItem(item)void지정된 항목을 삭제합니다.
deleteResponse(responseId)Form양식의 응답 저장소에서 단일 응답을 삭제합니다.
getConfirmationMessage()String양식의 확인 메시지를 가져옵니다.
getCustomClosedFormMessage()String양식에서 응답을 수락하지 않는 경우 표시되는 맞춤 메시지를 가져오거나 맞춤 메시지가 설정되지 않은 경우 빈 문자열을 가져옵니다.
getDescription()String양식의 설명을 가져옵니다.
getDestinationId()String양식의 응답 대상 ID를 가져옵니다.
getDestinationType()DestinationType양식의 응답 대상 유형을 가져옵니다.
getEditUrl()String양식의 수정 모드에 액세스하는 데 사용할 수 있는 URL을 가져옵니다.
getEditors()User[]Form의 편집자 목록을 가져옵니다.
getId()String양식의 ID를 가져옵니다.
getItemById(id)Item지정된 ID가 있는 항목을 가져옵니다.
getItems()Item[]양식에 있는 모든 항목의 배열을 가져옵니다.
getItems(itemType)Item[]지정된 유형의 모든 항목의 배열을 가져옵니다.
getPublishedUrl()String양식에 응답하는 데 사용할 수 있는 URL을 가져옵니다.
getResponse(responseId)FormResponse응답 ID를 기반으로 단일 양식 응답을 가져옵니다.
getResponses()FormResponse[]양식의 모든 응답의 배열을 가져옵니다.
getResponses(timestamp)FormResponse[]지정된 날짜 및 시간 이후에 양식의 모든 응답의 배열을 가져옵니다.
getShuffleQuestions()Boolean양식의 각 페이지에 있는 질문의 순서가 무작위로 정해졌는지 확인합니다.
getSummaryUrl()String양식 응답 요약을 보는 데 사용할 수 있는 URL을 가져옵니다.
getTitle()String양식의 제목을 가져옵니다.
hasLimitOneResponsePerUser()Boolean양식에서 응답자당 하나의 응답만 허용할지 결정합니다.
hasProgressBar()Boolean양식에 진행률 표시줄을 표시할지를 결정합니다.
hasRespondAgainLink()Boolean응답자가 양식을 작성한 후 다른 응답을 제출할 수 있는 링크를 양식에 표시할지 결정합니다.
isAcceptingResponses()Boolean양식이 현재 응답을 수락하는지 여부를 결정합니다.
isPublishingSummary()Boolean응답자가 양식을 작성한 후 응답 요약을 볼 수 있는 링크를 양식에 표시할지를 결정합니다.
isQuiz()Boolean양식이 퀴즈인지 여부를 결정합니다.
moveItem(from, to)Item양식의 모든 항목 중에서 지정된 색인에 있는 항목을 다른 지정된 색인으로 이동합니다.
moveItem(item, toIndex)Item양식의 모든 항목 중에서 지정된 항목을 지정된 색인으로 이동합니다.
removeDestination()Form양식을 현재 응답 대상에서 연결 해제합니다.
removeEditor(emailAddress)Form지정된 사용자를 Form의 편집자 목록에서 삭제합니다.
removeEditor(user)Form지정된 사용자를 Form의 편집자 목록에서 삭제합니다.
requiresLogin()Boolean양식에서 응답자가 응답하기 전에 동일한 도메인 또는 하위 도메인의 계정에 로그인해야 하는지 여부를 결정합니다.
setAcceptingResponses(enabled)Form양식에서 현재 응답을 수락하는지 여부를 설정합니다.
setAllowResponseEdits(enabled)Form응답을 제출한 후 응답을 수정할 수 있는 링크를 양식에 표시할지 여부를 설정합니다.
setCollectEmail(collect)Form양식에서 응답자의 이메일 주소를 수집할지 여부를 설정합니다.
setConfirmationMessage(message)Form양식의 확인 메시지를 설정합니다.
setCustomClosedFormMessage(message)Form양식에서 응답을 수락하지 않을 경우 표시할 메시지를 설정합니다.
setDescription(description)Form양식의 설명을 설정합니다.
setDestination(type, id)Form양식 응답이 저장되는 위치를 설정합니다.
setIsQuiz(enabled)Form양식이 퀴즈인지 여부를 설정합니다.
setLimitOneResponsePerUser(enabled)Form양식에서 응답자당 하나의 응답만 허용할지 여부를 설정합니다.
setProgressBar(enabled)Form양식에 진행률 표시줄을 포함할지 여부를 설정합니다.
setPublishingSummary(enabled)Form응답자가 양식을 제출한 후 응답 요약을 볼 수 있는 링크를 양식에 표시할지를 설정합니다.
setRequireLogin(requireLogin)Form양식에서 응답자가 응답하기 전에 동일한 도메인 또는 하위 도메인의 계정에 로그인해야 하는지 여부를 설정합니다.
setShowLinkToRespondAgain(enabled)Form응답자가 양식을 작성한 후 다른 응답을 제출할 수 있는 링크를 양식에 표시할지를 설정합니다.
setShuffleQuestions(shuffle)Form양식의 각 페이지에서 질문 순서를 무작위로 정할지 여부를 설정합니다.
setTitle(title)Form양식의 제목을 설정합니다.
shortenFormUrl(url)String양식의 긴 URL을 단축 URL로 변환합니다.
submitGrades(responses)Form지정된 FormResponses의 성적을 제출합니다.

자세한 문서

addCheckboxGridItem()

열과 행의 그리드로 표시되는 새 질문 항목을 추가하여 응답자가 일련의 체크박스에서 행당 여러 선택 항목을 선택할 수 있도록 합니다.

// 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']);

리턴

CheckboxGridItem - 새로 만든 항목입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

addCheckboxItem()

응답자가 하나 이상의 체크박스를 선택할 수 있는 새 질문 항목과 선택사항인 '기타' 필드를 추가합니다.

// 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']);

리턴

CheckboxItem - 새로 만든 항목입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

addDateItem()

응답자가 날짜를 표시할 수 있도록 새 질문 항목을 추가합니다.

// 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.');

리턴

DateItem - 새로 만든 항목입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

addDateTimeItem()

응답자가 날짜와 시간을 표시할 수 있는 새 질문 항목을 추가합니다.

// 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);

리턴

DateTimeItem - 새로 만든 항목입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

addDurationItem()

응답자가 기간을 표시할 수 있는 새 질문 항목을 추가합니다.

// 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);

리턴

DurationItem - 새로 만든 항목입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

addEditor(emailAddress)

지정된 사용자를 Form의 편집자 목록에 추가합니다. 사용자가 이미 뷰어 목록에 있는 경우 이 메서드는 사용자를 뷰어 목록에서 제거할 수 있습니다.

매개변수

이름유형설명
emailAddressString추가할 사용자의 이메일 주소입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

addEditor(user)

지정된 사용자를 Form의 편집자 목록에 추가합니다. 사용자가 이미 뷰어 목록에 있는 경우 이 메서드는 사용자를 뷰어 목록에서 제거할 수 있습니다.

매개변수

이름유형설명
userUser추가할 사용자의 표현입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

addEditors(emailAddresses)

지정된 사용자 배열을 Form의 편집자 목록에 추가합니다. 사용자가 이미 뷰어 목록에 있다면 이 메서드는 해당 사용자를 뷰어 목록 밖으로 승격시킵니다.

매개변수

이름유형설명
emailAddressesString[]추가할 사용자의 이메일 주소 배열입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

addGridItem()

새 질문 항목을 추가하고 열과 행의 그리드로 표시하여 응답자가 일련의 라디오 버튼에서 행당 하나의 선택 항목을 선택할 수 있도록 합니다.

// 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']);

리턴

GridItem - 새로 만든 항목입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

addImageItem()

이미지를 표시하는 새 레이아웃 항목을 추가합니다.

// 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);

리턴

ImageItem - 새로 만든 항목입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

addListItem()

응답자가 드롭다운 목록에서 하나의 선택지를 선택할 수 있는 새 질문 항목을 추가합니다.

// 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')
]);

리턴

ListItem - 새로 만든 항목입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

addMultipleChoiceItem()

응답자가 라디오 버튼 목록이나 선택사항인 'other' 필드에서 한 가지 선택지를 선택할 수 있는 새 질문 항목을 추가합니다.

// 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]);

리턴

MultipleChoiceItem - 새로 만든 항목입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

addPageBreakItem()

페이지의 시작을 표시하는 새 레이아웃 항목을 추가합니다.

// 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);

리턴

PageBreakItem - 새로 만든 항목입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

addParagraphTextItem()

응답자가 텍스트 블록을 입력할 수 있는 새 질문 항목을 추가합니다.

// 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?');

리턴

ParagraphTextItem - 새로 만든 항목입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

addScaleItem()

응답자가 번호가 매겨진 일련의 라디오 버튼 중에서 하나의 옵션을 선택할 수 있는 새 질문 항목을 추가합니다.

// 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');

리턴

ScaleItem - 새로 만든 항목입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

addSectionHeaderItem()

섹션의 시작을 시각적으로 나타내는 새 레이아웃 항목을 추가합니다.

 // 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');

리턴

SectionHeaderItem - 새로 만든 항목입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

addTextItem()

응답자가 한 줄의 텍스트를 입력할 수 있는 새 질문 항목을 추가합니다.

// 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?');

리턴

TextItem - 새로 만든 항목입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

addTimeItem()

응답자가 시간을 표시할 수 있는 새 질문 항목을 추가합니다.

// 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?');

리턴

TimeItem - 새로 만든 항목입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

addVideoItem()

동영상을 표시하는 새 레이아웃 항목을 추가합니다.

// 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);

리턴

VideoItem - 새로 만든 항목입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

canEditResponse()

응답을 제출한 후 응답을 수정할 수 있는 링크를 양식에 표시할지 결정합니다.

이 설정과 관계없이 FormResponse.getEditResponseUrl() 메서드를 사용하면 양식에 대한 수정 액세스 권한이 있는 스크립트 작성자가 응답 수정에 사용할 수 있는 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.
// 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);

리턴

Boolean - 양식에 '응답 수정' 링크가 표시되면 true, 표시되지 않으면 false입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

collectsEmail()

양식에서 응답자의 이메일 주소를 수집할지 결정합니다.

// 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);

리턴

Boolean: 양식에서 이메일 주소를 수집하면 true이고 수집하지 않는 경우 false입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

createResponse()

양식에 대한 새 응답을 만듭니다. 질문 항목에 응답하려면 항목에서 ItemResponse를 만든 다음 FormResponse.withItemResponse(response)를 호출하여 이 양식 응답에 첨부합니다. 조합된 응답을 저장하려면 FormResponse.submit()를 호출합니다.

리턴

FormResponse - 새로 생성된 양식 응답입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

deleteAllResponses()

양식의 응답 저장소에서 제출된 모든 응답을 삭제합니다. 이 메서드는 스프레드시트와 같은 외부 응답 대상에 저장된 응답 사본을 삭제하지 않지만 양식의 요약 보기는 지웁니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

deleteItem(index)

양식의 모든 항목 중에서 지정된 색인에 있는 항목을 삭제합니다. 지정된 색인에 항목이 없으면 스크립팅 예외가 발생합니다.

// 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);
}

매개변수

이름유형설명
indexInteger양식의 모든 항목 중 항목의 색인입니다.

생성 값

Error: 지정된 색인에 항목이 없는 경우

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

deleteItem(item)

지정된 항목을 삭제합니다. 항목이 이미 삭제된 경우 스크립팅 예외가 발생합니다.

// 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);
}

매개변수

이름유형설명
itemItem삭제할 항목입니다.

생성 값

Error: 양식에 항목이 없는 경우

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

deleteResponse(responseId)

양식의 응답 저장소에서 단일 응답을 삭제합니다. 이 메서드는 스프레드시트와 같은 외부 응답 대상에 저장된 응답의 사본을 삭제하지 않지만 양식의 요약 뷰에서 응답을 삭제합니다. 응답 ID는 FormResponse.getId()로 가져올 수 있습니다.

매개변수

이름유형설명
responseIdString삭제할 양식 응답의 ID입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

getConfirmationMessage()

양식의 확인 메시지를 가져옵니다.

// 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);

리턴

String - 양식의 확인 메시지입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

getCustomClosedFormMessage()

양식에서 응답을 수락하지 않는 경우 표시되는 맞춤 메시지를 가져오거나 맞춤 메시지가 설정되지 않은 경우 빈 문자열을 가져옵니다.

// 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);

리턴

String - 양식에서 응답을 수락하지 않는 경우 표시할 맞춤 메시지이며, 맞춤 메시지가 설정되지 않은 경우 빈 문자열입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

getDescription()

양식의 설명을 가져옵니다.

// 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);

리턴

String - 양식의 설명.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

getDestinationId()

양식의 응답 대상 ID를 가져옵니다.

// 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);

리턴

String - 양식의 응답 대상 ID입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

getDestinationType()

양식의 응답 대상 유형을 가져옵니다.

// 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);

리턴

DestinationType - 양식의 응답 대상 유형입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

getEditUrl()

양식의 수정 모드에 액세스하는 데 사용할 수 있는 URL을 가져옵니다.

// 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);

리턴

String - 양식을 수정할 URL입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

getEditors()

Form의 편집자 목록을 가져옵니다.

리턴

User[] - 수정 권한이 있는 사용자의 배열입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

getId()

양식의 ID를 가져옵니다.

// 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);

리턴

String - 양식의 ID입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

getItemById(id)

지정된 ID가 있는 항목을 가져옵니다. ID가 양식의 항목에 해당하지 않으면 null를 반환합니다.

// 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);

매개변수

이름유형설명
idInteger항목의 ID입니다.

리턴

Item: 지정된 ID의 항목 또는 양식에 항목이 없는 경우 null입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

getItems()

양식에 있는 모든 항목의 배열을 가져옵니다.

// 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);

리턴

Item[] - 양식에 있는 모든 항목의 배열입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

getItems(itemType)

지정된 유형의 모든 항목의 배열을 가져옵니다.

// 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);

매개변수

이름유형설명
itemTypeItemType검색할 항목의 유형입니다.

리턴

Item[] - 이 유형의 모든 항목의 배열.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

getPublishedUrl()

양식에 응답하는 데 사용할 수 있는 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.
// 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);

리턴

String - 양식에 응답할 URL입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

getResponse(responseId)

응답 ID를 기반으로 단일 양식 응답을 가져옵니다. 응답 ID는 FormResponse.getId()에서 가져올 수 있습니다.

매개변수

이름유형설명
responseIdString양식 응답의 ID입니다.

리턴

FormResponse - 양식 응답입니다.

생성 값

Error: 응답이 없는 경우

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

getResponses()

양식의 모든 응답의 배열을 가져옵니다.

리턴

FormResponse[] - 모든 양식의 응답 배열입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

getResponses(timestamp)

지정된 날짜 및 시간 이후에 양식의 모든 응답의 배열을 가져옵니다.

매개변수

이름유형설명
timestampDate양식 응답을 반환해야 하는 가장 빠른 날짜 및 시간입니다.

리턴

FormResponse[] - 양식 응답 목록입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

getShuffleQuestions()

양식의 각 페이지에 있는 질문의 순서가 무작위로 정해졌는지 확인합니다.

리턴

Boolean: 양식의 각 페이지에서 질문 순서가 무작위로 지정된 경우 true, 그렇지 않은 경우 false입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

getSummaryUrl()

양식 응답 요약을 보는 데 사용할 수 있는 URL을 가져옵니다. setPublishingSummary(enabled)true로 설정되지 않은 이상, 양식에 대한 수정 권한이 있는 사용자만 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);

리턴

String - 응답 요약을 볼 수 있는 URL입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

getTitle()

양식의 제목을 가져옵니다.

// 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);

리턴

String - 양식의 제목입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

hasLimitOneResponsePerUser()

양식에서 응답자당 하나의 응답만 허용할지 결정합니다. 값이 true이면 스크립트가 양식 응답을 전혀 제출할 수 없습니다.

리턴

Boolean - 양식에서 응답자당 하나의 응답만 허용하는 경우 true, 그러지 않으면 false입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

hasProgressBar()

양식에 진행률 표시줄을 표시할지를 결정합니다.

// 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());

리턴

Boolean: 양식에 진행률 표시줄이 표시되면 true, 표시되지 않으면 false입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

응답자가 양식을 작성한 후 다른 응답을 제출할 수 있는 링크를 양식에 표시할지 결정합니다.

// 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());

리턴

Boolean - 양식에 '다른 응답 제출' 링크가 표시되면 true, 표시되지 않으면 false입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

isAcceptingResponses()

양식이 현재 응답을 수락하는지 여부를 결정합니다.

// 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);

리턴

Boolean: 양식에서 응답을 수락하면 true, 수락하지 않으면 false입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

isPublishingSummary()

응답자가 양식을 작성한 후 응답 요약을 볼 수 있는 링크를 양식에 표시할지를 결정합니다.

// 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);

리턴

Boolean - 양식에 '이전 응답 보기' 링크가 표시되면 true, 표시되지 않으면 false입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

isQuiz()

양식이 퀴즈인지 여부를 결정합니다.

// 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());

리턴

Boolean: 양식에서 응답을 수락하면 true, 수락하지 않으면 false입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

moveItem(from, to)

양식의 모든 항목 중에서 지정된 색인에 있는 항목을 다른 지정된 색인으로 이동합니다. to 색인이 범위를 벗어나면 스크립팅 예외가 발생합니다.

// 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);

매개변수

이름유형설명
fromInteger양식의 모든 항목 중 항목의 현재 색인입니다.
toInteger양식의 모든 항목 중 항목의 새 색인입니다.

리턴

Item - 이동된 항목입니다.

생성 값

Error: 두 색인 중 하나가 범위를 벗어난 경우

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

moveItem(item, toIndex)

양식의 모든 항목 중에서 지정된 항목을 지정된 색인으로 이동합니다. 지정된 색인이 범위를 벗어나면 스크립팅 예외가 발생합니다.

// 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);

매개변수

이름유형설명
itemItem이동할 항목입니다.
toIndexInteger양식의 모든 항목 중 항목의 새 색인입니다.

리턴

Item - 이동된 항목입니다.

생성 값

Error: 색인이 범위를 벗어난 경우

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

removeDestination()

양식을 현재 응답 대상에서 연결 해제합니다. 연결 해제된 이전 대상에는 여전히 모든 이전 응답의 사본이 보관됩니다. 대상이 명시적으로 설정되지 않은 양식을 포함한 모든 양식은 양식의 응답 저장소에 응답 사본을 저장합니다. 양식에 현재 응답 대상이 없으면 이 메서드는 아무런 영향을 미치지 않습니다.

// 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();

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

removeEditor(emailAddress)

지정된 사용자를 Form의 편집자 목록에서 삭제합니다. 일반 액세스 권한이 있는 사용자 클래스에 속한 경우(예: Form가 사용자의 전체 도메인과 공유되거나 Form가 사용자가 액세스할 수 있는 공유 드라이브에 있는 경우) 이 메서드는 사용자가 Form에 액세스하는 것을 차단하지 않습니다.

Drive 파일의 경우 뷰어 목록에서도 사용자가 삭제됩니다.

매개변수

이름유형설명
emailAddressString삭제할 사용자의 이메일 주소입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

removeEditor(user)

지정된 사용자를 Form의 편집자 목록에서 삭제합니다. 일반 액세스 권한이 있는 사용자 클래스에 속한 경우(예: Form가 사용자의 전체 도메인과 공유되거나 Form가 사용자가 액세스할 수 있는 공유 드라이브에 있는 경우) 이 메서드는 사용자가 Form에 액세스하는 것을 차단하지 않습니다.

Drive 파일의 경우 뷰어 목록에서도 사용자가 삭제됩니다.

매개변수

이름유형설명
userUser삭제할 사용자의 표현입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

requiresLogin()

양식에서 응답자가 응답하기 전에 동일한 도메인 또는 하위 도메인의 계정에 로그인해야 하는지 여부를 결정합니다.

// 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);

리턴

Boolean: 양식에서 사용자에게 로그인을 요구하는 경우 true, 필요하지 않은 경우 false


setAcceptingResponses(enabled)

양식에서 현재 응답을 수락하는지 여부를 설정합니다. 새 양식의 기본값은 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());

매개변수

이름유형설명
enabledBoolean양식에서 응답을 받아야 하는 경우 true, 허용되지 않아야 하면 false입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

setAllowResponseEdits(enabled)

응답을 제출한 후 응답을 수정할 수 있는 링크를 양식에 표시할지 여부를 설정합니다. 새 양식의 기본값은 false입니다.

이 설정과 관계없이 FormResponse.getEditResponseUrl() 메서드를 사용하면 양식에 대한 수정 권한이 있는 스크립트 작성자가 응답 수정에 사용할 수 있는 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.
// 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());

매개변수

이름유형설명
enabledBoolean양식에 '응답 수정' 링크를 표시해야 하는 경우 true, 표시되지 않으면 false입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

setCollectEmail(collect)

양식에서 응답자의 이메일 주소를 수집할지 여부를 설정합니다. 새 양식의 기본값은 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);

매개변수

이름유형설명
collectBoolean양식에서 이메일 주소를 수집해야 하는 경우 true, 수집하지 않는 경우 false입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

setConfirmationMessage(message)

양식의 확인 메시지를 설정합니다.

// 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);

매개변수

이름유형설명
messageString양식의 새 확인 메시지입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

setCustomClosedFormMessage(message)

양식에서 응답을 수락하지 않을 경우 표시할 메시지를 설정합니다. 메시지가 설정되지 않으면 양식에서 기본 메시지를 사용합니다.

// 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);

매개변수

이름유형설명
messageString양식에서 응답을 수락하지 않는 경우 표시할 메시지입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

setDescription(description)

양식의 설명을 설정합니다.

매개변수

이름유형설명
descriptionString양식의 새 설명입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

setDestination(type, id)

양식 응답이 저장되는 위치를 설정합니다. 대상이 명시적으로 설정되지 않은 양식을 포함한 모든 양식은 양식의 응답 저장소에 응답 사본을 저장합니다.

매개변수

이름유형설명
typeDestinationType양식의 응답 대상 유형입니다.
idString양식의 응답 대상 ID입니다.

리턴

Form: 체이닝을 위한 Form입니다.

생성 값

Error: 지정된 대상 ID가 잘못된 경우

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

setIsQuiz(enabled)

양식이 퀴즈인지 여부를 설정합니다. 새 양식의 기본값은 false입니다.

채점되는 질문은 퀴즈에서만 허용되므로 false로 설정하면 모든 질문에서 모든 채점 옵션이 삭제됩니다.

퀴즈 설정은 새 Forms UI에서만 사용할 수 있습니다. 양식을 퀴즈로 만들면 양식에서 새 UI를 사용하도록 설정됩니다.

// 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());

매개변수

이름유형설명
enabledBoolean양식에 퀴즈 기능을 사용 설정해야 하는 경우 true, 사용 설정하지 않으면 false입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

setLimitOneResponsePerUser(enabled)

양식에서 응답자당 하나의 응답만 허용할지 여부를 설정합니다. 새 양식의 기본값은 false입니다. 값을 true로 설정하면 스크립트가 양식 응답을 전혀 제출할 수 없습니다.

매개변수

이름유형설명
enabledBoolean양식에서 응답자당 하나의 응답만 허용해야 하는 경우 true, 허용되지 않는 경우 false입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

setProgressBar(enabled)

양식에 진행률 표시줄을 포함할지 여부를 설정합니다. 새 양식의 기본값은 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());

매개변수

이름유형설명
enabledBoolean양식에 진행률 표시줄이 표시되면 true, 표시되지 않으면 false입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

setPublishingSummary(enabled)

응답자가 양식을 제출한 후 응답 요약을 볼 수 있는 링크를 양식에 표시할지를 설정합니다. 새 양식의 기본값은 false입니다.

매개변수

이름유형설명
enabledBoolean양식에 '이전 응답 보기' 링크가 표시되어야 하는 경우 true, 표시되지 않으면 false입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

setRequireLogin(requireLogin)

양식에서 응답자가 응답하기 전에 동일한 도메인 또는 하위 도메인의 계정에 로그인해야 하는지 여부를 설정합니다. 도메인 관리자가 기본값을 변경하지 않는 한 새 양식의 기본값은 false입니다.

이 기능은 Google Workspace 사용자가 만든 양식에서만 사용할 수 있습니다. 다른 유형의 Google 계정 사용자는 로그인할 필요가 없습니다.

// 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());

매개변수

이름유형설명
requireLoginBoolean양식에서 사용자에게 로그인을 요구하는 경우 true, 필요하지 않은 경우 false

리턴

Form: 현재 형식 (체이닝용)입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

setShowLinkToRespondAgain(enabled)

응답자가 양식을 작성한 후 다른 응답을 제출할 수 있는 링크를 양식에 표시할지를 설정합니다. 새 양식의 기본값은 true입니다.

매개변수

이름유형설명
enabledBoolean양식에 '다른 응답 제출' 링크가 표시되어야 하는 경우 true, 표시되지 않으면 false입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

setShuffleQuestions(shuffle)

양식의 각 페이지에서 질문 순서를 무작위로 정할지 여부를 설정합니다.

매개변수

이름유형설명
shuffleBoolean양식의 각 페이지에 있는 질문 순서를 무작위로 지정해야 하는 경우 true이고, 그렇지 않으면 false입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

setTitle(title)

양식의 제목을 설정합니다.

매개변수

이름유형설명
titleString양식의 새 제목입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

shortenFormUrl(url)

양식의 긴 URL을 단축 URL로 변환합니다. 긴 URL이 Google Forms에 속하지 않는 경우 예외가 발생합니다.

매개변수

이름유형설명
urlString단축할 URL입니다.

리턴

String - http://goo.gl/forms/1234 형식의 URL입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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

submitGrades(responses)

지정된 FormResponses의 성적을 제출합니다.

코드에 onFormSubmit 트리거가 포함된 경우 submitGrades()를 호출하면 onFormSubmit 조건이 트리거되고 무한 루프가 발생합니다. 무한 루프를 방지하려면 submitGrades()를 호출하기 전에 성적이 이미 존재하는지 확인하는 코드를 추가합니다.

매개변수

이름유형설명
responsesFormResponse[]양식의 모든 응답의 배열입니다.

리턴

Form: 체이닝을 위한 Form입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

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