title: Google Sheets Script to Duplicate & Rename Spreadsheets
body: <p>I'm creating a script in Google Sheets that will copy the active sheet and create 30 duplicate sheets within the same workbook. Each duplicated sheet will have a different name based on the value within a cell on the active sheet. The cell will contain a date; duplicated sheets will have names of dates after the date listed in the cell. Example, cell B3 is "7/5/2019". The duplicated sheets should be named, "July 6, 2019" (B3+1), "July 7, 2019" (B3+2), &amp; "July 8, 2019" (B3+3), etc.</p>
  
  <p>I'm using code that is already embedded within Google Sheets. Some of it was created by recording a macro and other parts were created through what little I know about coding and research online.</p>
  
  <pre><code>function duplicatesheet(){
  
  //copy active sheet
  var as = SpreadsheetApp.getActiveSpreadsheet()
  SpreadsheetApp.getActiveSpreadsheet().duplicateActiveSheet();
  
  //rename sheet
  var myValue = 
  SpreadsheetApp.getActiveSpreadsheet().getRange('B3').getValue();
  SpreadsheetApp.getActiveSpreadsheet().renameActiveSheet(myValue);
  
  }
  </code></pre>
  
  <p>The code works in duplicating the active sheet once, but it is not making 30 duplicates. It is also not renaming the sheets properly as described above based on the date listed in cell B3. I need help creating code that will accomplish both of those tasks.</p>