I am working on a survey using Google Forms that I generated via a script. There are over 2000 questions that are all the same format but are broken up into different sections.

So, for example, there are 80+ Google Forms, each with 25 sections. Each section has a different prompt but the same question. I want to be able to add a question to each prompt on the Google Form using a script. The problem is that the addMultipleChoiceItem() method adds questions to the end of the form. This means that the last prompt/last section of the form will have the question I want to add appended to it 25 times.


Prompt 1:
Question 1
Question 2
Section break
Prompt 2:
Question 1
Question 2
Section break
Prompt 25
Question 1
Question 2
New Question
New Question
New Question (x25)

Is there a way to add a question to each section of the form using a script? I don't want to manually insert every question because there are so many sections and it would take many man hours.

Any help will be much appreciated!

Edit. Here is the current script:

function updateLists() {

  var files = DriveApp.getFolderById("FOLDER_ID").getFiles() //the folder that contains all the Google Forms
  var ss = SpreadsheetApp.getActive().getSheetByName("QUESTION 1"); //get the spreadsheet
  var agentValues = ss.getRange(1, 1, ss.getMaxRows() - 1).getValues(); //get all the values form the spreadsheet
  var agentNames = [];

  for(var i = 0; i < agentValues.length; i++){
    if(agentValues[i][0] != ""){
      agentNames[i] = agentValues[i][0];

  //loop through all the forms in the folder
  while (files.hasNext()) {

    var file = files.next(); //holds the current file
    var form = FormApp.openById(file.getId()) //gets the id of the form
    Logger.log("Form" + form.getTitle());
    var items = form.getItems(); //holds all the individual parts of the form

    //loop through each section and each item in each section
    for (var i = 0; i < items.length; i++){

      var item = items[i];
      Logger.log("item:" + item.getTitle());

      if(item.getTitle() === "Title of Last Question in the Section") {
        var temp = form.addMultipleChoiceItem();
        temp.setTitle("New Question to be added");
  • Do you already verified that Google Forms is able to handle 2000 questions? I have seen reports of forms that are not able to handle a lot less than that. – Rubén Jun 6 '18 at 20:23
  • From GPF How many questions can I create in Google Forms? (they are taling about 100 - 150 questions) – Rubén Jun 6 '18 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.