title: Get share link of multiple files in Google Drive to put in spreadsheet
body: <p>I have this script which creates shareable links from files inside the folder, and then puts the links into a spreadsheet.</p>
  
  <pre><code>function myFunction() {
    var ss=SpreadsheetApp.getActiveSpreadsheet();
    var s=ss.getActiveSheet();
    var c=s.getActiveCell();
    var fldr=DriveApp.getFolderById("REPLACE_[ID]_HERE");
    var files=fldr.getFiles();
    var names=[],f,str;
    while (files.hasNext()) {
      f=files.next();
      str='=hyperlink("' + f.getUrl() + '","' + f.getName() + '")';
      names.push([str]);
    }
    s.getRange(c.getRow(),c.getColumn(),names.length).setFormulas(names);
  }
  </code></pre>
  
  <p>Instead I get this error</p>
  
  <pre><code>The number of rows in the range must be at least 1. (line 13, file "Code")
  </code></pre>
  
  <p>Script was based off this answer
  <a href="https://webapps.stackexchange.com/a/119646">https://webapps.stackexchange.com/a/119646</a></p>