Google Apps Script: how to copy array of objects to range?
<p>I have an array of objects called <code>membership</code>:</p>

<pre><code>[{name: 'Linus Pauling', address: '1805 Main Street', phone: '(615) 555-1010', 
  email: 'linus.pauling@gmail.com' },

 {name: 'Maury Povich', address: '382 North Street', phone: '(423) 555-1997', 
  email: 'maury@themauryshow.org'}]
</code></pre>

<p>(Although only 4 are shown here, I really have ten key/value pairs per member.)</p>

<p>What is the best way to copy bits of this array to a range of cells in Google Sheets?  I am trying to find a method to call the object values directly, and use the .SetValues method to copy them en masse, as opposed to one at a time.</p>

<p>To get all the members' names in column A, I've tried:</p>

<pre><code>sheet.getRange(1,1,membership.length,1).setValues(membership[{member.name}]);
</code></pre>

<p>...which gives <code>Missing : after property ID.</code></p>

<p>Or:</p>

<pre><code>sheet.getRange(1,1,membership.length,1).setValues([membership[name]]);
</code></pre>

<p>...which gives ReferenceError: "name" is not defined.</p>

<p>Or:</p>

<pre><code>sheet.getRange(1,1,membership.length,1).setValues([member.name]);
</code></pre>

<p>...which gives the "Cannot convert Array to Object[][]" error.</p>

<p>I apologize for the newbie question.  I have seen <a href="https://stackoverflow.com/questions/12278721/call-function-which-writes-array-to-range">answers</a> about how to copy values from a multidimensional array to a sheet's range, but not an array of objects.</p>