title: Create Folders and Log Details to Spreadsheet
body: <p>I'm trying to write a script that creates a child folder inside of every folder within a designated parent folder. This part works fine. However the script also needs to log the folder name and URL to a separate spreadsheet in columns A &amp; B. This is what I can't seem to get working. I'm still a little green with JS so any help would be greatly appreciated. </p>
  
  <pre><code>var folders = DriveApp.getFolderById('xxxxx').getFolders();
  var ss = SpreadsheetApp.openByUrl('xxxxx').getSheetByName('Sheet1');
  var counter = 0;  
  
  while (folders.hasNext()){
    var folder = folders.next();
    var folderName = folder.getName();
    var folderUrl = folder.createFolder("Child Folder - " + folderName);
    counter++
      for (i = 0; i &lt; counter.length; i++){
        var valueRange = ss.getRange(i,1,1,2);
        var values = [[folderName, folderUrl]];
        range.setValues(valueRange);
      }    
    }
  }
  </code></pre>