title: How to apply function to multiple sheets when loading by IDs
body: <p>each day I run a script to format the appearance of a dozen or so new spreadsheets that are automatically generated.</p>
  
  <p>First I place them in a folder on Google drive and run a script that generates a list of all file ID's in the folder, then I copy and paste each ID into a new script 1 at a time and run it.
  Basically I am loading the sheets by using <code>var ss = SpreadsheetApp.openById("&lt;id goes here&gt;");</code></p>
  
  <p>Since I already have the list of 15 or so ID's (this number can change each day), I'm wondering if there's a way I can alter the script so that it will go through each ID and complete. Here's an example of what the code would be:</p>
  
  <pre><code>function format() {
    var ss = SpreadsheetApp.openById("&lt;id goes here&gt;");
    var sheet = ss.getActiveSheet();
    var range = sheet.getDataRange();
    var numRows = range.getNumRows();
    for(var i=2; i&lt;=numRows; i++){
      sheet.setRowHeight(i, 320);
      }
    sheet.deleteColumn(3);
    sheet.setColumnWidth(1, 72);
    sheet.setColumnWidth(2, 150);
    sheet.setColumnWidth(3, 300);
    sheet.setColumnWidth(4, 150);
    sheet.setColumnWidth(5, 150);
    sheet.setColumnWidth(6, 300);
    var maxColumns = sheet.getMaxColumns(); 
    var lastColumn = sheet.getLastColumn();
    if (maxColumns-lastColumn != 0){
        sheet.deleteColumns(lastColumn+1, maxColumns-lastColumn);
        }
    var maxRows = sheet.getMaxRows();
    if (maxRows-numRows != 0){
        sheet.deleteRows(numRows+1, maxRows-numRows);
      } 
  };
  </code></pre>