title: Google Script - convert sheet to XLSX
body: <p>I have this code that search new doc in drive folder, and send files via email</p>
  
  <pre><code>var ss = SpreadsheetApp.getActiveSpreadsheet(); 
  var sheet = ss.getActiveSheet();
  
  var email = "xxx@gmail.com";      
  var timezone = ss.getSpreadsheetTimeZone();
  
  var today     = new Date();
  var oneDayAgo = new Date(today.getTime() - 1 * 24 * 60 * 60 * 1000);  
  var startTime = oneDayAgo.toISOString();
  
  var search = '(trashed = false or trashed = false) and (modifiedDate &gt; "' +    startTime + '")';
  var folder1 = DriveApp.getFoldersByName('SaveToPDF').next();
  var files1  = folder1.searchFiles(search);
  
  var row = "", count=0;
  
  while( files1.hasNext() ) {
  
  var file1 = files1.next();
  
  var fileName = file1.getName();
  var fileURL  = file1.getUrl();
  var lastUpdated =  Utilities.formatDate(file1.getLastUpdated(), timezone, "yyyy-MM-dd HH:mm");
  var dateCreated =  Utilities.formatDate(file1.getDateCreated(), timezone, "yyyy-MM-dd HH:mm")
  
  row += "&lt;li&gt;" + lastUpdated + " &lt;a href='" + fileURL + "'&gt;" + fileName + "&lt;/a&gt;&lt;/li&gt;";
  
  sheet.appendRow([dateCreated, lastUpdated, fileName, fileURL]);
  
  count++;
  }
  if (row !== "") {
  row = "&lt;p&gt;" + count + " file(s) have changed in your Google Drive in the past 24 hours. Here's the list:&lt;/p&gt;&lt;ol&gt;" + row + "&lt;/ol&gt;";
  row +=  "&lt;br&gt;&lt;small&gt;To stop these notifications, please &lt;a href='" + ss.getUrl() + "'&gt;click here&lt;/a&gt; and choose &lt;em&gt;Uninstall&lt;/em&gt; from the Drive Activity menu.&lt;br/&gt;&lt;/small&gt;";
  MailApp.sendEmail(email, "Google Drive - File Activity Report", "", {htmlBody: row, cc: "xxx@gmail.com"} );
    }
  </code></pre>
  
  <p>I need to convert sheet files to XLSX format before send. 
  Can someone help me?</p>
  
  <p>Thanks</p>