title: Trying to save a copy of a file to specific Google Drive folder, from URLs in a Google Sheet
body: <p>I am running this code in google Apps Script to save a copy of a file (photo) in a specific folder, from a URL link extracted from a Google Sheet. The photos are in other peoples google drive accounts..</p>
  <p>This google sheet comes from ODK form that different people fill in during field work surveys, and i need to centralize all the data to my Gdrive.</p>
  <p>The URLs are in colum L of this spreadsheet
  <a href="https://docs.google.com/spreadsheets/d/14vtEHDxxNc0d4yEn4T0gZcEyePJeJgw6NqQ9ajmn1fo/view#gid=0" rel="nofollow noreferrer">https://docs.google.com/spreadsheets/d/14vtEHDxxNc0d4yEn4T0gZcEyePJeJgw6NqQ9ajmn1fo/view#gid=0</a></p>
  <p>The folder ID i am trying to save files to is:&quot;1ImYcc_HqFZjpCUj4BHprhu3HSXKNQS0E&quot;</p>
  <p>I run my code but nothing happens. (I have turned the API on)</p>
  <p>I am new to coding so i am very lost.</p>
  <pre><code>var ss=SpreadsheetApp.getActiveSpreadsheet();
    var sheetName = &quot;Sheet1&quot;;
    var sh = ss.getSheetByName(sheetName);
    var rangeA1 = &quot;L6:L68&quot;;
    var rg=sh.getRange(rangeA1);
  
  
    var formulas = rg.getFormulas();
  
    for (var i in formulas) {
      for (var j in formulas[i]) {
        var formula = formulas[i][j];
        if (formula.length !=0){
  
          var regex = /=\w+\((.*)\)/i;
          var matches = formula.match(regex);
          var imgurl = matches[1];
          var filename = imgurl.substring(imgurl.lastIndexOf(&quot;/&quot;) + 1, imgurl.lastIndexOf(&quot;&quot;));
          Logger.log(filename); 
  
   var image = UrlFetchApp.fetch(imgurl).getBlob().getAs('image/jpg').setName(filename);
  
          var folder = DriveApp.getFolderById(&quot;1ImYcc_HqFZjpCUj4BHprhu3HSXKNQS0E&quot;);
          var file = DriveApp.createFile(image);
          Drive.Files.update({&quot;parents&quot;: [{&quot;id&quot;: folder.getId()}]}, file.getId());
        }
      }
    }
  }```
  </code></pre>