title: Concatenation of single quote marks Google Script
body: <p>I have three columns of data</p>
  
  <pre><code>selector                                            label     option list
  time you personally have been engaged with uscan    label_1   Arts
  time you personally have been engaged with uscan    label_2   Children’s Issues
  time you personally have been engaged with uscan    label_3   Coaching
  time you personally have been engaged with uscan    label_4   Community Development
  time you personally have been engaged with uscan    label_5   Conflict
  time you personally have been engaged with uscan    label_6   Consulting
  </code></pre>
  
  <p>I am trying to concatenate these columns so that in the 4th column I get</p>
  
  <pre><code>option {
  label: "Label_1;
  selector: ["time you personally have been engaged with uscan"="Arts"];
  }
  
  option {
  label: "Label_2;
  selector: ["time you personally have been engaged with uscan"="Children’s Issues"];
  }
  etc
  </code></pre>
  
  <p>My attempt</p>
  
  <pre><code>result[i] = [""option {label:""" + values[i][0] + "";" + "selector: [" + values[i][0] + ""=" +  + values[i][1] + ""];}"];
  </code></pre>
  
  <p>Foiled by all the single quotes that are required</p>
  
  <p>Thank you</p>
  
  <p>GS</p>
  
  <pre><code>function OptionsList() {
    var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("OptionList");
    var lr = sheet.getLastRow();
    var values = sheet.getRange(2, 1, lr,3).getValues();
    var result = [];
  
    //Add items to results
    for(var i=0; i&lt;lr; i++){
  
      result[i] = [""option {label:""" + values[i][0] + "";" + "selector: [" + values[i][0] + ""=" +  + values[i][1] + ""];}"];
  
  }
  
  //Post back to column 4 starting on row 2
  sheet.getRange(2, 4, lr, 1).setValues(result);
  }
  </code></pre>