Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to export questions and multiple choice options from a Google Form to a Google Sheet?

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.

like image 977
L Nicol Avatar asked Oct 26 '19 14:10

L Nicol


People also ask

How do I import questions from Google Forms to Sheets?

Visit Google Forms, sign in, and open the form you want to pull questions into. Select the question where you want to insert an imported question below. Then, click the Import Questions icon in the toolbar to the right.

Can I export questions from Google Forms?

With a G Suite Add-on, you can directly export questions to Google Quiz Forms. They're easy to deliver to your students, instantly scorable, and beautifully formatted! The export option works with any documents you create in Problem-Attic, including documents you've already made.

Can you export Google Forms to Google Sheets?

That's great for quick form results, but for more tools to analyze answers, you can link your form to a Google Sheets spreadsheet. Just click the green Sheets icon in the Responses tab or click Select response destination in the menu, then create a new spreadsheet or select an existing one to store the answers.


2 Answers

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
like image 79
alberto vielma Avatar answered Sep 21 '22 18:09

alberto vielma


I got almost the same problem that you were dealing with, I created a little script with the documentation for my own purposes but I think it may help you to understand how to retrieve the information.

You need to be aware of these two API: https://developers.google.com/apps-script/reference/forms (forms) and https://developers.google.com/apps-script/reference/spreadsheet (sheets)

Google Form mapping

Then, I would check how to post it into a Google Sheet through the API.

Check you have all the permissions set.

like image 33
Dante Bazaldua Avatar answered Sep 21 '22 18:09

Dante Bazaldua