问题
We have a series of Google Forms that contain multiple choice questions, each with 4 possible answers.
I would like to be able to export the question and all possible answers to a Google Sheet for all of the questions and answers in that Google Form.
For example:
Q1: What is the capital of England?
- A: London
- B: Paris
- C: Madrid
- D: Helsinki
I've tried a variety of add-ons. There are loads that allow Google Sheets > Google Form, but nothing in reverse (that I can find), so I assume it will be a script of some kind.
Any help would be really appreciated.
Thanks. Liam.
回答1:
In the following code, which I made using Apps Script, you can find a way to extract questions and answers from a google form and then put the values in a certain sheet of your choice
// Open a form by ID.
var form = FormApp.openById('YOUR-FORM-ID');
// Open a sheet by ID.
var sheet = SpreadsheetApp.openById('YOUR-SHEET-ID').getSheets()[0];
// variables for putting the questions and answers in the right position
var question_position = 0;
var answers_position = 0;
// main function to run
function getFormValues() {
form.getItems().forEach(callback);
}
// Iterate over all questions
function callback(el){
// check if the question is multiple choice
if (el.getType() == FormApp.ItemType.MULTIPLE_CHOICE) {
// change the type from Item to MultipleChoiceItem
var question = el.asMultipleChoiceItem();
var choices = question.getChoices();
// set the title of the question in the cell
sheet.getRange(question_position +1, 1).setValue(question.getTitle());
var i = 0;
// set the answers in the right cells
for (i; i < choices.length; i++){
sheet.getRange(answers_position + 1, 2).setValue(choices[i].getValue());
answers_position++;
}
question_position += i;
answers_position++;
}
question_position++;
}
Docs:
If you're wondering where I got all this info you can check these two links:
- Spreadsheet
- Google Forms
回答2:
This seems like you'd need an Apps Script add-on or a manually developed Apps-Script script. Try to find a freelancer or a coworker to build it for you.
Sheets is the easiest to work with: https://developers.google.com/apps-script/reference/spreadsheet/
来源:https://stackoverflow.com/questions/58571874/is-it-possible-to-export-questions-and-multiple-choice-options-from-a-google-for