title: Google AppScript GetRange Shorten Script
body: <p>I was wondering if there was any way I could shorten the script below? As you can see, I copied the eight lines (B13-I13) to make a new one with a different row (B4-I14). However, I must continue it until row 23.</p>
  <pre><code>var values = [[formS.getRange(&quot;C7&quot;).getValue(),
                formS.getRange(&quot;C8&quot;).getValue(),
                formS.getRange(&quot;D9&quot;).getValue(),
  
                formS.getRange(&quot;B13&quot;).getValue(), &lt;--- shorten this
                formS.getRange(&quot;C13&quot;).getValue(),
                formS.getRange(&quot;D13&quot;).getValue(), 
                formS.getRange(&quot;E13&quot;).getValue(), 
                formS.getRange(&quot;F13&quot;).getValue(),   
                formS.getRange(&quot;G13&quot;).getValue(),   
                formS.getRange(&quot;H13&quot;).getValue(),
                formS.getRange(&quot;I13&quot;).getValue(), ----&gt; to this
  
                formS.getRange(&quot;B14&quot;).getValue(), &lt;--- shorten this
                formS.getRange(&quot;C14&quot;).getValue(),
                formS.getRange(&quot;D14&quot;).getValue(), 
                formS.getRange(&quot;E14&quot;).getValue(), 
                formS.getRange(&quot;F14&quot;).getValue(),   
                formS.getRange(&quot;G14&quot;).getValue(),   
                formS.getRange(&quot;H14&quot;).getValue(),
                formS.getRange(&quot;I14&quot;).getValue(), ----&gt; to this
  ]];
  </code></pre>
  <p>This is the script that I'm using..</p>
  <pre><code>function SaveData() {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var formS = ss.getSheetByName(&quot;Form&quot;);
    var dataS = ss.getSheetByName(&quot;Data&quot;);
  
    --&gt; LOCATION OF THE SCRIPT ABOVE &lt;---
  
    dataS.getRange(dataS.getLastRow()+1,1,1,11).setValues(values);
    ClearCell();
  }
  </code></pre>
  <p>Please see the sample picture below where I encode the data.
  <a href="https://i.stack.imgur.com/k6uSn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k6uSn.png" alt="enter image description here" /></a></p>
  <p>This is the sample image of the sheet where the data were being saved.
  <a href="https://i.stack.imgur.com/A9agv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A9agv.png" alt="enter image description here" /></a></p>
  <p><a href="https://docs.google.com/spreadsheets/d/1L8aKA50RgMX850VH-toKZ0glcuE8VPh2WZCsR_YLINw/edit?usp=sharing" rel="nofollow noreferrer">SAMPLE SPREADSHEET</a></p>