title: Remove row of table in a Google Document with Google Apps Script
body: <p>I'm trying to create documents massively using information from a spreadsheet to Google using Google Apps Script, but I don't know how to use the Table class (specifically the method: RemoveRow)</p>
  
  <p>I created an example (less complex) in order to illustrate my problem. I have a Google document called "<a href="https://docs.google.com/document/d/1SbRJ0dWjv9q2yMIm6AmxWocnYktLFpVg8Q82lVCunVQ/edit" rel="nofollow">Sales Reports</a>", this document read information from this Google Sheets called <a href="https://docs.google.com/spreadsheets/d/1P6pkcgf1OErTQ0mkw7zGXpOlEchDUflumAhYCqXBeq4/edit#gid=0" rel="nofollow">Data</a>. So far no problem, I can do it.</p>
  
  <p>However, there are a condition. The product A and product B are exclusive, that is: if I buy "product A" then, I do not buy the "product B" and vice versa. The Google Docs must show 1 row (not 2). The code is similar to this:</p>
  
  <pre><code>var TEMPLATE_ID = 'xyz';
  function createPdf() {
    var activeSheet = SpreadsheetApp.getActiveSheet(),
    numberOfColumns = activeSheet.getLastColumn(),
    numberOfRows = activeSheet.getLastRow(),
    activeRowIndex = activeSheet.getActiveRange().getRowIndex(),
    activeRow = '',
    headerRow = activeSheet.getRange(1, 1, numberOfRows, numberOfColumns).getValues()
    var destFolder = DriveApp.getFolderById("aaaaaaa");
  
   for(i=2;i&lt;=numberOfRows;i++) {
   var copyFile = DriveApp.getFileById(TEMPLATE_ID).makeCopy()
   copyId = copyFile.getId(),
   copyDoc = DocumentApp.openById(copyId),
   copyBody = copyDoc.getActiveSection()
   activeRow = activeSheet.getRange(i, 1, 1, numberOfColumns).getValues();
  
   for (columnIndex = 0;columnIndex &lt; headerRow[0].length; columnIndex++) {
      copyBody.replaceText('%' + headerRow[0][columnIndex] + '%', 
                       ''+activeRow[0][columnIndex]);    
  }
  
  
  copyDoc.saveAndClose()
  
                                .....
              //code: create pdf with the custom template
  
  }
  
  } //fin del crear
  </code></pre>
  
  <p>What are the changes that I need to do? </p>
  
  <p>Greetings, Thanks in advance.</p>