title: Google Apps Script to email sheet as a PDF working but want to clear some cells
body: <p>I have edited a script I found to Email a PDF created from the spreadhseet to recipients in the spreadsheet. It is working as I need it to however I need to delete some of the cells before the PDF is created. What would the correct code be to add in to delete from row 194 or cells a194:j200. Code attached below.</p>
  
  <p>Thanks for your help</p>
  
  <pre><code>// Simple function to send Weekly Schedule Sheets to contacts listed on the "Tutors" sheet in the Spreadsheet.
  
  // Load a menu item called "Admin Tasks" with a submenu item called "Email Schedule"
  // Running this, sends the currently open sheet, as a PDF attachment
  function onOpen() {
    var submenu = [{name:"Email Schedule", functionName:"tempsheet"}];
    SpreadsheetApp.getActiveSpreadsheet().addMenu('Admin Tasks', submenu);  
  }
  
  function tempsheet() {
    // Set the Active Spreadsheet so we don't forget
    var originalSpreadsheet = SpreadsheetApp.getActive();
  
    // Set the message to attach to the email.
    var message = "Please find weekly schedule attached. Contact office for any changes as soon as possible"; 
    // Get Project Name from Cell A1
    var projectname = originalSpreadsheet.getRange("A1:A1").getValues(); 
    // Get Reporting Period from Cell B3
    var period = originalSpreadsheet.getRange("F2:F2").getValues(); 
    // Construct the Subject Line
    var subject = projectname + " - Weekly Schedule Sheet - " + period;
  
  
    // Get contact details from "Tutors" sheet and construct To: Header
    var contacts = originalSpreadsheet.getSheetByName("Tutors");
    var numRows = contacts.getLastRow();
    var emailTo = contacts.getRange(2, 5, numRows, 1).getValues();
  
    // Create a new Spreadsheet and copy the current sheet into it.
    var newSpreadsheet = SpreadsheetApp.create("Temporary Schedule");
    var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
    var projectname = SpreadsheetApp.getActiveSpreadsheet();
    sheet = originalSpreadsheet.getActiveSheet();
    sheet.copyTo(newSpreadsheet);
  
  
    // Make PDF, currently called "Weekly Schedule.pdf"
    var pdf = DocsList.getFileById(newSpreadsheet.getId()).getAs('application/pdf').getBytes();
    var attach = {fileName:'Weekly Schedule.pdf',content:pdf, mimeType:'application/pdf'};
  
    // Send the freshly constructed email 
    MailApp.sendEmail(emailTo, subject, message, {attachments:[attach]});
  
    // Find and delete the default "Sheet 1", after the copy 
    newSpreadsheet.getSheetByName('copy of MASTERPLAN').activate();
    newSpreadsheet.deleteActiveSheet();
  
  
  
    // Delete the temporary sheet 
    DocsList.getFileById(newSpreadsheet.getId()).setTrashed(true);  
  }
  </code></pre>