nazmulisrony
New member
I have sql database on my voltage lab electrical site. I have export database on google excel sheet, can i make automation quiz from each row? so that i dont need to create manual data input.?
function createGoogleFormQuiz() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");
var data = sheet.getDataRange().getValues(); // Get all data from the sheet
// Create a new Google Form
var form = FormApp.create('Automated Quiz');
// Loop through each row in the sheet and add a question to the form
for (var i = 1; i < data.length; i++) {
var question = data[i][0]; // Question in the first column
var option1 = data[i][1]; // Option 1 in the second column
var option2 = data[i][2]; // Option 2 in the third column
var option3 = data[i][3]; // Option 3 in the fourth column
var option4 = data[i][4]; // Option 4 in the fifth column
// Add a multiple-choice question to the form
var item = form.addMultipleChoiceItem();
item.setTitle(question)
.setChoiceValues([option1, option2, option3, option4]);
}
Logger.log('Form URL: ' + form.getEditUrl()); // Log the form's URL
}