title: Getting substrings of each Array-Element
body: <p>I am trying to convert data stored in &quot;dd.mm.yy&quot; format to &quot;w&quot; format in Google Sheets/Appscript. Unfortunately I cannot use the &quot;.formatDate()&quot; function since sheets does not recognice the input values as date values, so I tried the following:</p>
  <pre><code>function CheckWeekNuber() {
     
   
    var dateStr =SpreadsheetApp.getActiveSpreadsheet().getSheetByName(&quot;INSERT RAW DATA HERE&quot;).getRange(3,5,300,4).getValues();
   
    var day = dateStr.substring(0,2);
    var month = dateStr.substring(3,5);
    var year = &quot;20&quot;+dateStr.substring(6,8);
    var weekNumb = Utilities.formatDate(new Date(year, month-1, day), &quot;GMT&quot;, &quot;w&quot;);
    SpreadsheetApp.getActiveSpreadsheet().getSheetByName(&quot;WEEKNUMBERS&quot;).getRange(3,5,300,4).setValues(weekNumb);
     
   }
  </code></pre>
  <p>It worked perfectly with a foor loop, converting each single value at a time. But it was super slow. My problem lays in using the &quot;.substring()&quot; formula for arrays, it does not seem to work..
  Do you have any idea how to fix it?</p>