title: How Import txt file with xml responses in google sheets with Google apps script?
body: <p>I have a log.txt file with records with this structure:</p>
  
  <pre><code>20190509 131952 CON  Parametros: [abc....]
  20190509 131952 CON  Changing Endpoint to https:.....
  20190509 131952 INF  SQL: select .....
  20190509 131952 CON  Outbound with header: 
  &lt;S:Envelope xmlns:S="http://schemas.........&lt;/S:Envelope&gt;
  </code></pre>
  
  <p>I just wanted to extract the lines with the xml response
  <code>&lt;S:Envelope xmlns:S="http://schemas.........&lt;/S:Envelope&gt;</code>
    and import to google sheets with the data in the corresponding column. </p>
  
  <p>I'm not an expert in apps script and I can not see how I can use XmlService to get the result. I think the ideal would be to import the file and for each line validate if it is an xml response if it is import into google sheets.
  Thank you if anyone could give me some directions on how to get what I want. I researched but could not find any example of this type.</p>
  
  <pre><code>function Importa() {
    var PastaAMonitorizar = DriveApp.getFolderById('abc_xyz'); // id da pasta onde txt está quardado
    var ss = SpreadsheetApp.openById('abc_xyz'); //id da folha para onde são importados os dados
    var files = PastaAMonitorizar.getFiles();
  
    while (files.hasNext()) {
      var file = files.next();
      var fileName = file.getName();
  
      var targetRng = ss.getSheetByName("INFO"),
          fileTextObj = file.getAs('text/plain'),
          fileText = fileTextObj.getDataAsString('ISO-8859-1'),
          lines = fileText.split('\n'),
  ...
  </code></pre>
  
  <p>I know Import a txt file, but but I can not figure out how to extract only the xml response</p>