title: Google Script to run across specific tabs in spreadsheet
body: <p>I have a Google Sheet with one tab for one individual and each tab's name relates to the individual. There are around 100 people each with their own tab in this spreadsheet.</p>
  
  <p>At the end of each month I need to clear down the previous month's data from a selection of unprotected ranges.</p>
  
  <p>Currently I have to run a script 100 times on each tab using this:</p>
  
  <pre><code>function clearData() { 
    // assign this to a button on each sheet
  // check user really wants to clear data
  
    var ui = SpreadsheetApp.getUi();
   var response = ui.alert('Are you sure you want to clear data for this month?', ui.ButtonSet.YES_NO);
  
   // Process the user's response.
   if (response == ui.Button.YES) {
       // get the name of the current sheet
     var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getName();
    var sheets = [ss,ss,ss];
    ['D2:D2', 'D4:AH9','D11:AH40'].forEach(function (r, i) {
    SpreadsheetApp.getActive().getSheetByName(sheets[i]).getRange(r).clearContent();
    })  
   } else {
  
   }
  }
  </code></pre>
  
  <p>I run that script via a button on each sheet.</p>
  
  <p>There must be a way to run one script that will loop through all the sheets of individuals and clear the data from each one. The script would have to get the appropriate sheetname from a range that contains all of the user's names.</p>
  
  <p>Is that possible?</p>
  
  <p>Can anyone help me get this working please?</p>
  
  <p>Thanks</p>