How to add a new line in google forms paragraph type question

For adding new line in google form question multiple choice question, add the following code in script editor:

Code: 

function addLineBreaks()

{

  var form = FormApp.getActiveForm(); 

  

  // find form items you need 

      var questions = form.getItems(FormApp.ItemType.PARAGRAPH_TEXT);

  

  for(i = 0i < questions.lengthi++)

  {

    var title = questions[i].getTitle();

    questions[i].setTitle(title.split(". ").join("\n"));

  }

}


Comments

  1. Thank you very much. That worked. I used the change suggested in the YouTube comments of replacing title.split(". ") with title.split("*") so that I can add line breaks only at those places where I want them, and have typed a "*".

    ReplyDelete
  2. Hi! I've tried the code. But I am confuse as I always get "SyntaxError: Invalid or unexpected token (line 14, file "Code.gs")" everytime I save the code. Pls help, thanks

    ReplyDelete
    Replies
    1. Looks like there will be some syntax error. Can you please copy the code here..

      Delete

Post a Comment

Popular posts from this blog

how to add new line in google form questions | Fix for next line issue in google form questions

How to add new line in dropdown type question in google forms