// THIS SCRIPT CONVERTS A GOOGLE SHEET FROM A NOTEBOOK LM EXPORT INTO A GOOGLE FORM.
// Step 1: Save excel file using NotebookLM ExportKit chrome extension.
// Step 2: Upload excel file to Drive. Remove all columns except question, options, answer. Remove row 1 (headers).
// Step 3: Save as google sheet. Then run the script below in Extensions>App Script
function createDynamicQuiz() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var data = sheet.getDataRange().getValues();
var form = FormApp.create('NotebookLM Dynamic Quiz');
form.setIsQuiz(true);
for (var i = 0; i < data.length; i++) {
var row = data[i];
var question = row[0];
var correctAnswer = row[row.length - 1]; // Assumes the last column is the answer
var item = form.addMultipleChoiceItem();
item.setTitle(question);
var choices = [];
// This loop looks at columns B through the second-to-last column
for (var j = 1; j < row.length - 1; j++) {
if (row[j] !== "" && row[j] !== null) { // Only add if the cell isn't empty
var isCorrect = (row[j] == correctAnswer);
choices.push(item.createChoice(row[j], isCorrect));
}
}
item.setChoices(choices).setPoints(1);
}
Browser.msgBox('Quiz Created Successfully!');
}
Comments
0 B
|0 👍
/0 👎
0 B
|👍
/👎