Terhangat
Loading...

Script import 1000 soal pada google form


Langkah untuk mengimport lebih dari 100 soal ke google form yaitu.
1. Silahkan siapkan soal-soalnya dalam excell dengan cara menuliskan mendatar
2. Masuk ke google drive kalian, buat spreadsheet.
3. Copy pastekan soal kalian kedalam spreadsheet yang telah kalian buat
4. Klik alat / tool kemudian pilih script editor
5. Copy Script dibawah ini. (doble klik untuk blok semua script)

<script type="text/javascript">
// BloggerJS v0.3.1
// Copyright (c) 2017-2018 Kenny Cruz
// Licensed under the MIT License
function quizForm() {
  var ss = SpreadsheetApp.getActive();
  var sheet = ss.getSheetByName('Sheet1');
  var numberRows = sheet.getDataRange().getNumRows();
  var myQuestions = sheet.getRange(2,2,numberRows,1).getValues();
  var myAnswers = sheet.getRange(2,3,numberRows,5).getValues();
  var myChoice = sheet.getRange(2,8,numberRows,1).getValues();
  var form = FormApp.create('Matematika X');
  form.setDescription('DATA PESERTA PENILAIAN AKHIR TAHUN 2020');
  form.setIsQuiz(true);
  var nisn = form.addTextItem();
  var nama = form.addTextItem();
  var tglhr = form.addDateItem();
  var token = form.addTextItem();
  nisn.setTitle('NISN');
  nama.setTitle('Nama Lengkap');
  tglhr.setTitle('Tanggal Lahir');
  token.setTitle('TOKEN');
  nisn.setRequired(true);
  nama.setRequired(true);
  tglhr.setRequired(true);
  token.setRequired(true); 
  var textValidation = FormApp.createTextValidation()
  .setHelpText('TOKEN salah hubungi guru atau admin')
  .requireTextMatchesPattern('CAKEP')
  .build();
  token.setValidation(textValidation);
  var sect = form.addPageBreakItem().setTitle("SOAL-SOAL MATEMATIKA KELAS X"); 
  for(var i=0;i<numberRows-1;i++){
      if (myChoice[i][0] == 'A') {
      var addItem = form.addMultipleChoiceItem();
      addItem.setTitle(myQuestions[i][0])
      .setPoints(1)
      .setChoices([
        addItem.createChoice(myAnswers[i][0],true),
        addItem.createChoice(myAnswers[i][1]),
        addItem.createChoice(myAnswers[i][2]),
        addItem.createChoice(myAnswers[i][3]),
        addItem.createChoice(myAnswers[i][4])
      ]);
      }
      else if (myChoice[i][0] == 'B') {
      var addItem = form.addMultipleChoiceItem();
      addItem.setTitle(myQuestions[i][0])
      .setPoints(1)
      .setChoices([
        addItem.createChoice(myAnswers[i][0]),
        addItem.createChoice(myAnswers[i][1],true),
        addItem.createChoice(myAnswers[i][2]),
        addItem.createChoice(myAnswers[i][3]),
        addItem.createChoice(myAnswers[i][4])
      ]);
      }
      else if (myChoice[i][0] == 'C') {
      var addItem = form.addMultipleChoiceItem();
      addItem.setTitle(myQuestions[i][0])
      .setPoints(1)
      .setChoices([
        addItem.createChoice(myAnswers[i][0]),
        addItem.createChoice(myAnswers[i][1]),
        addItem.createChoice(myAnswers[i][2],true),
        addItem.createChoice(myAnswers[i][3]),
        addItem.createChoice(myAnswers[i][4])
      ]);
      }
      else if (myChoice[i][0] == 'D') {
      var addItem = form.addMultipleChoiceItem();
      addItem.setTitle(myQuestions[i][0])
      .setPoints(1)
      .setChoices([
        addItem.createChoice(myAnswers[i][0]),
        addItem.createChoice(myAnswers[i][1]),
        addItem.createChoice(myAnswers[i][2]),
        addItem.createChoice(myAnswers[i][3],true),
        addItem.createChoice(myAnswers[i][4])
      ]);
      }
      else {
      var addItem = form.addMultipleChoiceItem();
      addItem.setTitle(myQuestions[i][0])
      .setPoints(1)
      .setChoices([
        addItem.createChoice(myAnswers[i][0]),
        addItem.createChoice(myAnswers[i][1]),
        addItem.createChoice(myAnswers[i][2]),
        addItem.createChoice(myAnswers[i][3]),
        addItem.createChoice(myAnswers[i][4],true)
      ]);
      }
  }
}

5. Jalankan

Kurang jelas scriptnya?? Download di sini
Lebih jelasnya perhatikan video tutorial berikut.


HALAMAN SELANJUTNYA:

iklan banner

Previous
Next Post »
Thanks for your comment
close