Class Form

Form

Genel özellikleri ve öğeleri içeren bir form. Başlık, ayarlar ve yanıtların depolandığı yer gibi özellikler bulunur. Öğeler arasında onay kutuları veya radyo düğmeleri gibi soru öğeleri yer alırken düzen öğeleri arasında sayfa sonları gibi şeyler bulunur. Formlara FormApp üzerinden erişilebilir veya formlar oluşturulabilir.

// Open a form by ID and create a new spreadsheet.
const form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
const 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());

Yöntemler

YöntemDönüş türüKısa açıklama
addCheckboxGridItem()CheckboxGridItemYanıtlayanın bir dizi onay kutusundan satır başına birden fazla seçenek belirlemesine olanak tanıyan, sütun ve satır tablosu olarak sunulan yeni bir soru öğesi ekler.
addCheckboxItem()CheckboxItemKatılımcının bir veya daha fazla onay kutusu seçmesine olanak tanıyan yeni bir soru öğesi ve isteğe bağlı bir "diğer" alanı ekler.
addDateItem()DateItemYanıtlayanın bir tarih belirtmesine olanak tanıyan yeni bir soru öğesi ekler.
addDateTimeItem()DateTimeItemKatılımcının tarih ve saat belirtmesine olanak tanıyan yeni bir soru öğesi ekler.
addDurationItem()DurationItemKatılımcının bir zaman uzunluğunu belirtmesine olanak tanıyan yeni bir soru öğesi ekler.
addEditor(emailAddress)FormBelirtilen kullanıcıyı Form için düzenleyenler listesine ekler.
addEditor(user)FormBelirtilen kullanıcıyı Form için düzenleyenler listesine ekler.
addEditors(emailAddresses)FormBelirtilen kullanıcı dizisini Form için düzenleyenler listesine ekler.
addGridItem()GridItemYanıtlayanın bir radyo düğmesi dizisinden satır başına bir seçenek belirlemesine olanak tanıyan, sütun ve satır tablosu olarak sunulan yeni bir soru öğesi ekler.
addImageItem()ImageItemResim gösteren yeni bir düzen öğesi ekler.
addListItem()ListItemKatılımcının açılır listeden bir seçenek belirlemesine olanak tanıyan yeni bir soru öğesi ekler.
addMultipleChoiceItem()MultipleChoiceItemKatılımcının radyo düğmeleri listesinden bir seçenek veya isteğe bağlı "diğer" alanını seçmesine olanak tanıyan yeni bir soru öğesi ekler.
addPageBreakItem()PageBreakItemSayfanın başlangıcını işaretleyen yeni bir düzen öğesi ekler.
addParagraphTextItem()ParagraphTextItemKatılımcının bir metin bloğu girmesine olanak tanıyan yeni bir soru öğesi ekler.
addPublishedReader(emailAddress)FormBelirtilen kullanıcıyı Form için yanıt verenler listesine ekler.
addPublishedReader(user)FormBelirtilen kullanıcıyı Form için yanıt verenler listesine ekler.
addPublishedReaders(emailAddresses)FormBelirtilen kullanıcı dizisini Form için yanıt verenler listesine ekler.
addRatingItem()RatingItemYanıtlayanın puan vermesine olanak tanıyan yeni bir soru öğesi ekler.
addScaleItem()ScaleItemKatılımcının numaralandırılmış bir radyo düğmesi dizisinden bir seçenek belirlemesine olanak tanıyan yeni bir soru öğesi ekler.
addSectionHeaderItem()SectionHeaderItemBir bölümün başlangıcını görsel olarak belirten yeni bir düzen öğesi ekler.
addTextItem()TextItemYanıtlayanın tek bir metin satırı girmesine olanak tanıyan yeni bir soru öğesi ekler.
addTimeItem()TimeItemYanıtlayanın günün saatini belirtmesine olanak tanıyan yeni bir soru öğesi ekler.
addVideoItem()VideoItemVideo gösteren yeni bir düzen öğesi ekler.
canEditResponse()BooleanFormun, gönderildikten sonra yanıtı düzenleme bağlantısı gösterip göstermeyeceğini belirler.
collectsEmail()BooleanFormun, katılımcıların e-posta adreslerini toplayıp toplamayacağını belirler.
createResponse()FormResponseForma yeni bir yanıt oluşturur.
deleteAllResponses()FormGönderilen tüm yanıtları formun yanıt deposundan siler.
deleteItem(index)voidFormdaki tüm öğeler arasında belirli bir dizindeki öğeyi siler.
deleteItem(item)voidBelirtilen öğeyi siler.
deleteResponse(responseId)FormFormun yanıt deposundan tek bir yanıtı siler.
getConfirmationMessage()StringFormun onay mesajını alır.
getCustomClosedFormMessage()StringForm yanıt kabul etmiyorsa görüntülenen özel mesajı veya özel mesaj ayarlanmamışsa boş dizeyi alır.
getDescription()StringFormun açıklamasını alır.
getDestinationId()StringFormun yanıt hedefinin kimliğini alır.
getDestinationType()DestinationTypeFormun yanıt hedefinin türünü alır.
getEditUrl()StringFormun düzenleme moduna erişmek için kullanılabilecek URL'yi alır.
getEditors()User[]Bu Form için düzenleyenlerin listesini alır.
getId()StringFormun kimliğini alır.
getItemById(id)Item|nullBelirli bir kimliğe sahip öğeyi alır.
getItems()Item[]Formdaki tüm öğelerin dizisini alır.
getItems(itemType)Item[]Belirli bir türdeki tüm öğelerin dizisini alır.
getPublishedReaders()User[]Bu Form için yanıt verenlerin listesini alır.
getPublishedUrl()StringForma yanıt vermek için kullanılabilecek URL'yi alır.
getResponse(responseId)FormResponseYanıt kimliğine göre tek bir form yanıtı alır.
getResponses()FormResponse[]Formun tüm yanıtlarının dizisini alır.
getResponses(timestamp)FormResponse[]Belirli bir tarih ve saatten sonraki tüm form yanıtlarının dizisini alır.
getShuffleQuestions()BooleanFormun her sayfasındaki soruların sırasının rastgele olup olmayacağını belirler.
getSummaryUrl()StringForm yanıtlarının özetini görüntülemek için kullanılabilecek URL'yi alır.
getTitle()StringFormun başlığını alır.
hasLimitOneResponsePerUser()BooleanFormun, katılımcı başına yalnızca bir yanıta izin verip vermeyeceğini belirler.
hasProgressBar()BooleanFormda ilerleme çubuğu gösterilip gösterilmeyeceğini belirler.
hasRespondAgainLink()BooleanFormu yanıtlayan kişi formu tamamladıktan sonra formda başka bir yanıt gönderme bağlantısının gösterilip gösterilmeyeceğini belirler.
isAcceptingResponses()BooleanFormun şu anda yanıt kabul edip etmediğini belirler.
isPublished()BooleanFormun yayınlanıp yayınlanmadığını belirler.
isPublishingSummary()BooleanFormu dolduran bir katılımcıdan sonra formda yanıtların özetini görüntüleme bağlantısının gösterilip gösterilmeyeceğini belirler.
isQuiz()BooleanFormun test olup olmadığını belirler.
moveItem(from, to)ItemFormdaki tüm öğeler arasında belirli bir dizindeki bir öğeyi başka bir dizine taşır.
moveItem(item, toIndex)ItemBelirli bir öğeyi formdaki tüm öğeler arasında belirli bir dizine taşır.
removeDestination()FormFormun mevcut yanıt hedefiyle bağlantısını kaldırır.
removeEditor(emailAddress)FormBelirtilen kullanıcıyı Form için düzenleyenler listesinden kaldırır.
removeEditor(user)FormBelirtilen kullanıcıyı Form için düzenleyenler listesinden kaldırır.
removePublishedReader(emailAddress)FormBelirtilen kullanıcıyı Form için yanıt verenler listesinden kaldırır.
removePublishedReader(user)FormBelirtilen kullanıcıyı Form için yanıt verenler listesinden kaldırır.
setAcceptingResponses(enabled)FormFormun şu anda yanıt kabul edip etmediğini ayarlar.
setAllowResponseEdits(enabled)FormFormun, gönderildikten sonra yanıtı düzenleme bağlantısı gösterip göstermeyeceğini ayarlar.
setCollectEmail(collect)FormFormun, katılımcıların e-posta adreslerini toplayıp toplamayacağını belirler.
setConfirmationMessage(message)FormFormun onay mesajını ayarlar.
setCustomClosedFormMessage(message)FormForm yanıt kabul etmiyorsa gösterilecek mesajı ayarlar.
setDescription(description)FormFormun açıklamasını ayarlar.
setDestination(type, id)FormForm yanıtlarının kaydedileceği hedefi belirler.
setIsQuiz(enabled)FormFormun test olup olmadığını ayarlar.
setLimitOneResponsePerUser(enabled)FormFormun, yanıtlayan başına yalnızca bir yanıta izin verip vermeyeceğini ayarlar.
setProgressBar(enabled)FormFormda ilerleme çubuğu olup olmayacağını ayarlar.
setPublished(enabled)FormFormun yayınlanıp yayınlanmayacağını ayarlar.
setPublishingSummary(enabled)FormYanıtlayan formu gönderdikten sonra formda yanıtların özetini görüntüleme bağlantısının gösterilip gösterilmeyeceğini ayarlar.
setShowLinkToRespondAgain(enabled)FormYanıtlayan formu tamamladıktan sonra formda başka bir yanıt gönderme bağlantısının gösterilip gösterilmeyeceğini ayarlar.
setShuffleQuestions(shuffle)FormFormun her sayfasındaki soruların sırasının rastgele belirlenip belirlenmeyeceğini ayarlar.
setTitle(title)FormFormun başlığını ayarlar.
shortenFormUrl(url)StringBir formun uzun URL'sini kısa URL'ye dönüştürür.
submitGrades(responses)FormBelirli FormYanıtları için notları gönderir.
supportsAdvancedResponderPermissions()BooleanFormun yayınlamayı destekleyip desteklemediğini belirler.

Ayrıntılı belgeler

addCheckboxGridItem()

Yanıtlayanın bir dizi onay kutusundan satır başına birden fazla seçenek belirlemesine olanak tanıyan, sütun ve satır tablosu olarak sunulan yeni bir soru öğesi ekler.

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

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

Return

CheckboxGridItem: Yeni oluşturulan öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addCheckboxItem()

Katılımcının bir veya daha fazla onay kutusu seçmesine olanak tanıyan yeni bir soru öğesi ve isteğe bağlı bir "diğer" alanı ekler.

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

Return

CheckboxItem: Yeni oluşturulan öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addDateItem()

Yanıtlayanın bir tarih belirtmesine olanak tanıyan yeni bir soru öğesi ekler.

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

Return

DateItem: Yeni oluşturulan öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addDateTimeItem()

Katılımcının tarih ve saat belirtmesine olanak tanıyan yeni bir soru öğesi ekler.

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

Return

DateTimeItem: Yeni oluşturulan öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addDurationItem()

Katılımcının bir zaman uzunluğunu belirtmesine olanak tanıyan yeni bir soru öğesi ekler.

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

Return

DurationItem: Yeni oluşturulan öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addEditor(emailAddress)

Belirtilen kullanıcıyı Form için düzenleyenler listesine ekler. Kullanıcı zaten izleyiciler veya yanıt verenler listesindeyse bu yöntem, kullanıcının listeden çıkarılmasını sağlar.

// 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 editor to the form.
// TODO(developer): replace the emailAddress.
form.addEditor('editor@uni.edu');

Parametreler

AdTürAçıklama
emailAddressStringEklenecek kullanıcının e-posta adresi.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addEditor(user)

Belirtilen kullanıcıyı Form için düzenleyenler listesine ekler. Kullanıcı zaten izleyiciler veya yanıt verenler listesindeyse bu yöntem, kullanıcının listeden çıkarılmasını sağlar.

// Opens the Forms file by its URL.
// TODO(developer): Replace the URL with your own.
const oldForm = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the editors from the old form.
const users = oldForm.getEditors();

// Creates a new form.
const newForm = FormApp.create('New form');

// Adds the editors to a new form.
users.forEach(user => newForm.addEditor(user));

Parametreler

AdTürAçıklama
userUserEklenecek kullanıcının temsili.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addEditors(emailAddresses)

Belirtilen kullanıcı dizisini Form için düzenleyenler listesine ekler. Kullanıcılardan herhangi biri zaten izleyiciler listesindeyse bu yöntem, söz konusu kullanıcıları izleyiciler listesinden çıkarır.

// 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 editors to the form.
// TODO(developer): replace the emailAddress.
form.addPublishedReaders(['editor1@uni.edu', 'editor2@uni.edu']);

Parametreler

AdTürAçıklama
emailAddressesString[]Eklenecek kullanıcıların e-posta adreslerinden oluşan bir dizi.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addGridItem()

Yanıtlayanın bir radyo düğmesi dizisinden satır başına bir seçenek belirlemesine olanak tanıyan, sütun ve satır tablosu olarak sunulan yeni bir soru öğesi ekler.

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

Return

GridItem: Yeni oluşturulan öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addImageItem()

Resim gösteren yeni bir düzen öğesi ekler.

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

Return

ImageItem: Yeni oluşturulan öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addListItem()

Katılımcının açılır listeden bir seçenek belirlemesine olanak tanıyan yeni bir soru öğesi ekler.

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

Return

ListItem: Yeni oluşturulan öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addMultipleChoiceItem()

Katılımcının radyo düğmeleri listesinden bir seçenek veya isteğe bağlı "diğer" alanını seçmesine olanak tanıyan yeni bir soru öğesi ekler.

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

Return

MultipleChoiceItem: Yeni oluşturulan öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addPageBreakItem()

Sayfanın başlangıcını işaretleyen yeni bir düzen öğesi ekler.

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

Return

PageBreakItem: Yeni oluşturulan öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addParagraphTextItem()

Katılımcının bir metin bloğu girmesine olanak tanıyan yeni bir soru öğesi ekler.

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

Return

ParagraphTextItem: Yeni oluşturulan öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addPublishedReader(emailAddress)

Belirtilen kullanıcıyı Form için yanıt verenler listesine ekler. Kullanıcı zaten düzenleyenler veya görüntüleyenler listesindeyse bu yöntemin etkisi olmaz.

// 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 responder to the form.
// TODO(developer): replace the emailAddress.
form.addPublishedReader('responder@uni.edu');

Parametreler

AdTürAçıklama
emailAddressStringEklenecek kullanıcının e-posta adresi.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addPublishedReader(user)

Belirtilen kullanıcıyı Form için yanıt verenler listesine ekler. Kullanıcı zaten düzenleyenler veya görüntüleyenler listesindeyse bu yöntemin etkisi olmaz.

// Opens the Forms file by its URL.
// TODO(developer): Replace the URL with your own.
const oldForm = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the responders from the old form.
const users = oldForm.getPublishedReaders();

// Creates a new form.
const newForm = FormApp.create('New form');

// Adds the responders to a new form.
users.forEach(user => newForm.addPublishedReader(user));

Parametreler

AdTürAçıklama
userUserEklenecek kullanıcının temsili.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addPublishedReaders(emailAddresses)

Belirtilen kullanıcı dizisini Form için yanıt verenler listesine ekler. Kullanıcı zaten düzenleyenler veya görüntüleyenler listesindeyse bu yöntemin etkisi olmaz.

// 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 responders to the form.
// TODO(developer): replace the emailAddress.
form.addPublishedReaders(['responder1@uni.edu', 'responder2@uni.edu']);

Parametreler

AdTürAçıklama
emailAddressesString[]Eklenecek kullanıcıların e-posta adreslerinden oluşan bir dizi.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addRatingItem()

Yanıtlayanın puan vermesine olanak tanıyan yeni bir soru öğesi ekler.

// 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 rating item.
const item = form.addRatingItem();

Return

RatingItem: Yeni oluşturulan öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addScaleItem()

Katılımcının numaralandırılmış bir radyo düğmesi dizisinden bir seçenek belirlemesine olanak tanıyan yeni bir soru öğesi ekler.

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

Return

ScaleItem: Yeni oluşturulan öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addSectionHeaderItem()

Bir bölümün başlangıcını görsel olarak belirten yeni bir düzen öğesi ekler.

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

Return

SectionHeaderItem: Yeni oluşturulan öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addTextItem()

Yanıtlayanın tek bir metin satırı girmesine olanak tanıyan yeni bir soru öğesi ekler.

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

Return

TextItem: Yeni oluşturulan öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addTimeItem()

Yanıtlayanın günün saatini belirtmesine olanak tanıyan yeni bir soru öğesi ekler.

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

Return

TimeItem: Yeni oluşturulan öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

addVideoItem()

Video gösteren yeni bir düzen öğesi ekler.

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

Return

VideoItem: Yeni oluşturulan öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

canEditResponse()

Formun, gönderildikten sonra yanıtı düzenleme bağlantısı gösterip göstermeyeceğini belirler.

Bu ayardan bağımsız olarak FormResponse.getEditResponseUrl() yöntemi, forma düzenleme erişimi olan bir komut dosyası yazarının yanıtı düzenlemek için kullanılabilecek bir URL oluşturmasına olanak tanır.

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

Return

Formda "Yanıtınızı düzenleyin" bağlantısı gösteriliyorsa Boolean, gösterilmiyorsa false.true

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

collectsEmail()

Formun, katılımcıların e-posta adreslerini toplayıp toplamayacağını belirler.

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

Return

Form e-posta adreslerini topluyorsa Boolean, toplamıyorsa true.false

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

createResponse()

Forma yeni bir yanıt oluşturur. Bir soru öğesini yanıtlamak için öğeden ItemResponse oluşturun, ardından FormResponse.withItemResponse(response) işlevini çağırarak bu form yanıtına ekleyin. Oluşturulan yanıtı kaydetmek için FormResponse.submit()'ı arayın.

Return

FormResponse: Yeni oluşturulan form yanıtı.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

deleteAllResponses()

Gönderilen tüm yanıtları formun yanıt deposundan siler. Bu yöntem, yanıtların harici bir yanıt hedefinde (ör. e-tablo) depolanan kopyalarını silmez ancak formun özet görünümünü temizler.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

deleteItem(index)

Formdaki tüm öğeler arasında belirli bir dizindeki öğeyi siler. Belirtilen dizinde öğe yoksa komut dosyası oluşturma istisnası oluşturur.

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

Parametreler

AdTürAçıklama
indexIntegerFormdaki tüm öğeler arasında öğenin dizini.

Verdiği hatalar

Error: Belirtilen dizinde öğe yoksa

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

deleteItem(item)

Belirtilen öğeyi siler. Öğe zaten silinmişse bir komut dosyası oluşturma istisnası oluşturur.

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

Parametreler

AdTürAçıklama
itemItemSilinecek öğe.

Verdiği hatalar

Error: Öğe formda yoksa

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

deleteResponse(responseId)

Formun yanıt deposundan tek bir yanıtı siler. Bu yöntem, yanıtların harici bir yanıt hedefinde (ör. e-tablo) saklanan kopyalarını silmez ancak yanıtı formun özet görünümünden kaldırır. Yanıt kimliği, FormResponse.getId() ile alınabilir.

Parametreler

AdTürAçıklama
responseIdStringSilinecek form yanıtının kimliği.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getConfirmationMessage()

Formun onay mesajını alır.

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

Return

String: Formun onay mesajı.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getCustomClosedFormMessage()

Form yanıt kabul etmiyorsa görüntülenen özel mesajı veya özel mesaj ayarlanmamışsa boş dizeyi alır.

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

Return

String — Form yanıt kabul etmiyorsa gösterilecek özel mesaj veya özel mesaj ayarlanmamışsa boş dize.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getDescription()

Formun açıklamasını alır.

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

Return

String: Formun açıklaması.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getDestinationId()

Formun yanıt hedefinin kimliğini alır.

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

Return

String: Formun yanıt hedefinin kimliği.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getDestinationType()

Formun yanıt hedefinin türünü alır.

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

Return

DestinationType: Formun yanıt hedefinin türü.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getEditUrl()

Formun düzenleme moduna erişmek için kullanılabilecek URL'yi alır.

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

Return

String: Formu düzenleme URL'si.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getEditors()

Bu Form için düzenleyenlerin listesini alır.

Return

User[]: Düzenleme iznine sahip kullanıcı dizisi.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getId()

Formun kimliğini alır.

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

Return

String: Formun kimliği.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getItemById(id)

Belirli bir kimliğe sahip öğeyi alır. Kimlik, formdaki bir öğeyle eşleşmiyorsa null değerini döndürür.

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

Parametreler

AdTürAçıklama
idIntegerÖğenin kimliği.

Return

Item|null: Belirtilen kimliğe sahip öğe veya öğe formda yoksa null.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getItems()

Formdaki tüm öğelerin dizisini alır.

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

Return

Item[]: Formdaki tüm öğelerin dizisi.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getItems(itemType)

Belirli bir türdeki tüm öğelerin dizisini alır.

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

Parametreler

AdTürAçıklama
itemTypeItemTypeAlınacak öğelerin türü.

Return

Item[]: Bu türdeki tüm öğelerin dizisi.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getPublishedReaders()

Bu Form için yanıt verenlerin listesini alır.

// 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 responders for the form.
const users = form.getPublishedReaders();
users.forEach(user => console.log(user.getEmail()));

Return

User[]: Yanıtlama izni olan kullanıcıların dizisi.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getPublishedUrl()

Forma yanıt vermek için kullanılabilecek URL'yi alır.

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

Return

String: Forma yanıt verme URL'si.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getResponse(responseId)

Yanıt kimliğine göre tek bir form yanıtı alır. Yanıt kimlikleri FormResponse.getId() adresinden alınabilir.

Parametreler

AdTürAçıklama
responseIdStringForm yanıtının kimliği.

Return

FormResponse — Form yanıtı.

Verdiği hatalar

Error: Yanıt yoksa

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getResponses()

Formun tüm yanıtlarının dizisini alır.

Return

FormResponse[]: Formun tüm yanıtlarının dizisi.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getResponses(timestamp)

Belirli bir tarih ve saatten sonraki tüm form yanıtlarının dizisini alır.

Parametreler

AdTürAçıklama
timestampDateForm yanıtlarının döndürülmesi gereken en erken tarih ve saat.

Return

FormResponse[]: Form yanıtlarının listesi.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getShuffleQuestions()

Formun her sayfasındaki soruların sırasının rastgele olup olmayacağını belirler.

Return

Formun her sayfasındaki soruların sırası rastgele belirleniyorsa Booleantrue, aksi takdirde false.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getSummaryUrl()

Form yanıtlarının özetini görüntülemek için kullanılabilecek URL'yi alır. setPublishingSummary(enabled) politikası true olarak ayarlanmadığı sürece URL'ye yalnızca formda düzenleme izni olan kullanıcılar erişebilir.

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

Return

String: Yanıtların özetini görüntülemek için kullanılan URL.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getTitle()

Formun başlığını alır.

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

Return

String: Formun başlığı.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

hasLimitOneResponsePerUser()

Formun, katılımcı başına yalnızca bir yanıta izin verip vermeyeceğini belirler. Değer true ise komut dosyası form yanıtlarını hiç gönderemez.

Return

Boolean: Form, yanıtlayan başına yalnızca bir yanıta izin veriyorsa true, aksi takdirde false.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

hasProgressBar()

Formda ilerleme çubuğu gösterilip gösterilmeyeceğini belirler.

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

Return

Boolean — Formda ilerleme çubuğu gösteriliyorsa true, gösterilmiyorsa false.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

Formu yanıtlayan kişi formu tamamladıktan sonra formda başka bir yanıt gönderme bağlantısının gösterilip gösterilmeyeceğini belirler.

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

Return

Formda "Başka bir yanıt gönder" bağlantısı gösteriliyorsa Boolean, gösterilmiyorsa true.false

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

isAcceptingResponses()

Formun şu anda yanıt kabul edip etmediğini belirler. Formun yayınlanma durumu değiştiğinde bu değerin üzerine yazılır.

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

Return

Form yanıt kabul ediyorsa Boolean, etmiyorsa true gösterilir.false

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

isPublished()

Formun yayınlanıp yayınlanmadığını belirler.

Bu özellik yalnızca yayınlamayı destekleyen formlarda kullanılabilir. Formun yayınlamayı destekleyip desteklemediğini kontrol etmek için supportsAdvancedResponderPermissions() simgesini kullanı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',
);

// Checks whether the form is published or not and logs it to the console.
console.log(form.isPublished());

Return

Form yayınlandıysa Boolean, yayınlanmadıysa true.false

Verdiği hatalar

Error: Desteklenmeyen formlarda çağrılırsa.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

isPublishingSummary()

Formu dolduran bir katılımcıdan sonra formda yanıtların özetini görüntüleme bağlantısının gösterilip gösterilmeyeceğini belirler.

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

Return

Boolean — Formda "Önceki yanıtları gör" bağlantısı gösteriliyorsa true, gösterilmiyorsa false.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

isQuiz()

Formun test olup olmadığını belirler.

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

Return

Form yanıt kabul ediyorsa Boolean, etmiyorsa true gösterilir.false

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

moveItem(from, to)

Formdaki tüm öğeler arasında belirli bir dizindeki bir öğeyi başka bir dizine taşır. to dizini sınırların dışındaysa komut dosyası oluşturma istisnası oluşturur.

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

Parametreler

AdTürAçıklama
fromIntegerFormdaki tüm öğeler arasında öğenin geçerli dizini.
toIntegerFormdaki tüm öğeler arasında öğenin yeni indeksi.

Return

Item: Taşınan öğe.

Verdiği hatalar

Error: İndekslerden biri sınırların dışındaysa.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

moveItem(item, toIndex)

Belirli bir öğeyi formdaki tüm öğeler arasında belirli bir dizine taşır. Belirtilen dizin sınırların dışındaysa komut dosyası oluşturma istisnası oluşturur.

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

Parametreler

AdTürAçıklama
itemItemTaşınacak öğe.
toIndexIntegerFormdaki tüm öğeler arasında öğenin yeni indeksi.

Return

Item: Taşınan öğe.

Verdiği hatalar

Error: Dizin sınırların dışındaysa.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

removeDestination()

Formun mevcut yanıt hedefiyle bağlantısını kaldırır. Bağlantısı kaldırılan eski hedef, önceki tüm yanıtların bir kopyasını saklamaya devam eder. Hedefi açıkça ayarlanmamış olanlar da dahil olmak üzere tüm formlar, yanıtların bir kopyasını formun yanıt deposuna kaydeder. Formda şu anda yanıt hedefi yoksa bu yöntemin hiçbir etkisi olmaz.

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

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

removeEditor(emailAddress)

Belirtilen kullanıcıyı Form için düzenleyenler listesinden kaldırır. Bu yöntem, genel erişime sahip kullanıcı sınıfına ait olmaları durumunda kullanıcıların Form erişmesini engellemez. Örneğin, Form kullanıcının alanının tamamıyla paylaşılıyorsa veya Form kullanıcının erişebileceği bir ortak Drive'da bulunuyorsa.Form

Drive dosyaları için bu işlem, kullanıcıyı görüntüleyenler ve yanıtlayanlar listesinden de kaldırır.

// Opens the Forms file by its URL.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Removes the editor from the form.
// TODO(developer): replace the emailAddress.
form.removeEditor('editor@uni.edu');

Parametreler

AdTürAçıklama
emailAddressStringKaldırılacak kullanıcının e-posta adresi.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

removeEditor(user)

Belirtilen kullanıcıyı Form için düzenleyenler listesinden kaldırır. Bu yöntem, genel erişime sahip kullanıcı sınıfına ait olmaları durumunda kullanıcıların Form erişmesini engellemez. Örneğin, Form kullanıcının alanının tamamıyla paylaşılıyorsa veya Form kullanıcının erişebileceği bir ortak Drive'da bulunuyorsa.Form

Drive dosyaları için bu işlem, kullanıcıyı görüntüleyenler listesinden de kaldırır.

// Opens the Forms file by its URL.
// TODO(developer): Replace the URL with your own.
const form1 = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the editors from the form.
const users = form1.getEditors();

// Opens another form.
// TODO(developer): Replace the URL with your own.
const form2 = FormApp.openByUrl('https://docs.google.com/forms/d/efg123456/edit');

// Removes editors from the form.
users.forEach(user => form2.removeEditor(user));

Parametreler

AdTürAçıklama
userUserKaldırılacak kullanıcının temsili.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

removePublishedReader(emailAddress)

Belirtilen kullanıcıyı Form için yanıt verenler listesinden kaldırır. Bu yöntem, genel erişime sahip bir kullanıcı sınıfına ait olmaları durumunda kullanıcıların Form erişmesini engellemez. Örneğin, Form kullanıcının alanının tamamıyla paylaşılıyorsa veya Form kullanıcının erişebileceği bir ortak Drive'da bulunuyorsa.Form

Drive dosyaları için bu işlem, kullanıcıyı görüntüleyenler ve düzenleyenler listesinden de kaldırır.

// Opens the Forms file by its URL.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Removes the responders from the form.
// TODO(developer): replace the emailAddress.
form.removePublishedReader('responder1@uni.edu');

Parametreler

AdTürAçıklama
emailAddressStringKaldırılacak kullanıcının e-posta adresi.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

removePublishedReader(user)

Belirtilen kullanıcıyı Form için yanıt verenler listesinden kaldırır. Bu yöntem, genel erişime sahip bir kullanıcı sınıfına ait olmaları durumunda kullanıcıların Form erişmesini engellemez. Örneğin, Form kullanıcının alanının tamamıyla paylaşılıyorsa veya Form, kullanıcının erişebileceği bir ortak Drive'da bulunuyorsa.Form

Drive dosyaları için bu işlem, kullanıcıyı görüntüleyenler ve düzenleyenler listesinden de kaldırır.

// Opens the Forms file by its URL.
// TODO(developer): Replace the URL with your own.
const form1 = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the responders from the form.
const users = form1.getPublishedReaders();

// Opens another form.
// TODO(developer): Replace the URL with your own.
const form2 = FormApp.openByUrl('https://docs.google.com/forms/d/efg123456/edit');

// Removes responders from the form.
users.forEach(user => form2.removePublishedReader(user));

Parametreler

AdTürAçıklama
userUserKaldırılacak kullanıcının temsili.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

setAcceptingResponses(enabled)

Formun şu anda yanıt kabul edip etmediğini ayarlar. Yeni formlar için varsayılan değer true'dır. Formun yayınlanma durumu değiştirildiğinde durumun üzerine yazılır.

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

Parametreler

AdTürAçıklama
enabledBooleanFormun yanıt kabul etmesi gerekiyorsa true, etmemesi gerekiyorsa false'ı tıklayın.

Return

Form: Zincirleme için bu Form.

Verdiği hatalar

Error (Yayınlanmamış bir formda etkinleştirilmişse)

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

setAllowResponseEdits(enabled)

Formun, gönderildikten sonra yanıtı düzenleme bağlantısı gösterip göstermeyeceğini ayarlar. Yeni formların varsayılan değeri false'dır.

Bu ayardan bağımsız olarak FormResponse.getEditResponseUrl() yöntemi, forma düzenleme izni olan bir komut dosyası yazarının yanıtı düzenlemek için kullanılabilecek bir URL oluşturmasına olanak tanır.

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

Parametreler

AdTürAçıklama
enabledBooleanFormda "Yanıtınızı düzenleyin" bağlantısı gösterilecekse true, gösterilmeyecekse false.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

setCollectEmail(collect)

Formun, katılımcıların e-posta adreslerini toplayıp toplamayacağını belirler. Yeni formlar için varsayılan değer false'dir.

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

Parametreler

AdTürAçıklama
collectBooleanFormun e-posta adreslerini toplaması gerekiyorsa true, gerekmiyorsa false.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

setConfirmationMessage(message)

Formun onay mesajını ayarlar.

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

Parametreler

AdTürAçıklama
messageStringFormun yeni onay mesajı.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

setCustomClosedFormMessage(message)

Form yanıt kabul etmiyorsa gösterilecek mesajı ayarlar. Mesaj ayarlanmamışsa formda varsayılan mesaj kullanılır.

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

Parametreler

AdTürAçıklama
messageStringForm yanıt kabul etmiyorsa gösterilecek mesaj.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

setDescription(description)

Formun açıklamasını ayarlar.

Parametreler

AdTürAçıklama
descriptionStringFormun yeni açıklaması.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

setDestination(type, id)

Form yanıtlarının kaydedileceği hedefi belirler. Hedefi açıkça ayarlanmamış olanlar da dahil olmak üzere tüm formlar, yanıtların bir kopyasını formun yanıt deposuna kaydeder.

Parametreler

AdTürAçıklama
typeDestinationTypeFormun yanıt hedefinin türü.
idStringFormun yanıt hedefinin kimliği.

Return

Form: Zincirleme için bu Form.

Verdiği hatalar

Error: Belirtilen hedef kimliği geçersizse

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

setIsQuiz(enabled)

Formun test olup olmadığını ayarlar. Yeni formlar için varsayılan değer false'dır.

Puan verilen sorulara yalnızca testlerde izin verilir. Bu nedenle, bu ayarın false olarak belirlenmesi, tüm sorulardan tüm puanlandırma seçeneklerinin kaldırılmasına neden olur.

Test ayarları yalnızca yeni Formlar kullanıcı arayüzünde kullanılabilir. Bir formu teste dönüştürmek için yeni kullanıcı arayüzü kullanılır.

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

Parametreler

AdTürAçıklama
enabledBooleanForm için test özelliklerinin etkinleştirilip etkinleştirilmeyeceği (true) veya etkinleştirilmeyeceği (false).

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

setLimitOneResponsePerUser(enabled)

Formun, yanıtlayan başına yalnızca bir yanıta izin verip vermeyeceğini ayarlar. Yeni formlar için varsayılan değer false'dir. Değer true olarak ayarlanırsa komut dosyası form yanıtlarını hiç gönderemez.

Parametreler

AdTürAçıklama
enabledBooleanForm, katılımcı başına yalnızca bir yanıta izin vermeliyse true, aksi takdirde false.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

setProgressBar(enabled)

Formda ilerleme çubuğu olup olmayacağını ayarlar. Yeni formlar için varsayılan değer false'dır.

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

Parametreler

AdTürAçıklama
enabledBooleanFormda ilerleme çubuğu gösteriliyorsa true, gösterilmiyorsa false simgesini tıklayın.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

setPublished(enabled)

Formun yayınlanıp yayınlanmayacağını ayarlar. Yeni formlar için varsayılan değer true'dır.

Bu özellik yalnızca yayınlamayı destekleyen formlarda kullanılabilir. Formun yayınlamayı destekleyip desteklemediğini kontrol etmek için supportsAdvancedResponderPermissions() simgesini kullanın.

Katılımcıların erişebilmesi için formun yayınlanması gerekir. Bu yöntem, setAcceptingResponses(enabled) çağrılarını geçersiz kılar.

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

// Publishes the form before sharing it.
form.setPublished(true);

// Checks whether the form is published or not and logs it to the console.
console.log(form.isPublished());

Parametreler

AdTürAçıklama
enabledBooleanForm yayınlanacaksa true, yayınlanmayacaksa false.

Return

Form: Zincirleme için bu Form.

Verdiği hatalar

Error: Desteklenmeyen formlarda çağrılırsa.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

setPublishingSummary(enabled)

Yanıtlayan formu gönderdikten sonra formda yanıtların özetini görüntüleme bağlantısının gösterilip gösterilmeyeceğini ayarlar. Yeni formlar için varsayılan değer false'dır.

Parametreler

AdTürAçıklama
enabledBooleanFormda "Önceki yanıtları gör" bağlantısı gösterilecekse true, gösterilmeyecekse false.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

setShowLinkToRespondAgain(enabled)

Yanıtlayan formu tamamladıktan sonra formda başka bir yanıt gönderme bağlantısının gösterilip gösterilmeyeceğini ayarlar. Yeni formlar için varsayılan değer true'dır.

Parametreler

AdTürAçıklama
enabledBooleantrue Formda "Başka bir yanıt gönder" bağlantısı gösterilip gösterilmeyeceğini, false gösterilmeyecekse.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

setShuffleQuestions(shuffle)

Formun her sayfasındaki soruların sırasının rastgele belirlenip belirlenmeyeceğini ayarlar.

Parametreler

AdTürAçıklama
shuffleBooleantrue Formun her sayfasındaki soruların sırası rastgele mi olmalı? false Değilse.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

setTitle(title)

Formun başlığını ayarlar.

Parametreler

AdTürAçıklama
titleStringFormun yeni başlığı.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

shortenFormUrl(url)

Bir formun uzun URL'sini kısa URL'ye dönüştürür. Uzun URL Google Formlar'a ait değilse istisna oluşturur.

Parametreler

AdTürAçıklama
urlStringKısaltılacak URL.

Return

String: http://goo.gl/forms/1234 biçiminde bir URL.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

submitGrades(responses)

Belirli FormYanıtları için notları gönderir.

Kodunuzda bir onFormSubmit tetikleyici varsa submitGrades() çağrısı onFormSubmit koşulunu tetikler ve sonsuz döngüye neden olur. Sonsuz döngüyü önlemek için submitGrades() işlevi çağrılmadan önce notların mevcut olup olmadığını kontrol eden bir kod ekleyin.

Parametreler

AdTürAçıklama
responsesFormResponse[]Formun tüm yanıtlarının dizisi.

Return

Form: Zincirleme için bu Form.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

supportsAdvancedResponderPermissions()

Formun yayınlamayı destekleyip desteklemediğini belirler. Bu yöntem, setPublished(enabled) ve isPublished() yöntemlerinin ve yanıtlayıcı izinlerinin kullanılabilir olup olmadığını belirlemek için kullanılır.

// 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 whether the form supports publishing or not and logs it to the
// console.
console.log(form.supportsAdvancedResponderPermissions());

Return

Boolean — Form yayınlamayı destekliyorsa true, desteklemiyorsa false.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:

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

Desteği sonlandırılmış yöntemler