title: Merge Multiple CSV Files in single file on gdrive
body: <p>I've been trying to merge multiple csv files into single csv file from Google drive Folder, but I'm unable to do it as it works well with google sheets but not with csv files.</p>
  
  <p>I used the code that is already available on stackoverflow.com but it didn't work well with my requirements.</p>
  
  <pre><code>function mergeSheets() {
  
    /* Retrieve the desired folder */
    var myFolder = DriveApp.getFoldersByName("Test 1").next();
  
    /* Get all spreadsheets that resided on that folder */
    var spreadSheets = myFolder.getFilesByType("MimeType.csv");
  
    /* Create the new spreadsheet that you store other sheets */  
    var newSpreadSheet = SpreadsheetApp.create("Merged Sheets");
  
    /* Iterate over the spreadsheets over the folder */
    while(spreadSheets.hasNext()) {
  
      var sheet = spreadSheets.next();
  
      /* Open the spreadsheet */
      var spreadSheet = SpreadsheetApp.openById(sheet.getId());
  
      /* Get all its sheets */
      for(var y in spreadSheet.getSheets()) {
  
        /* Copy the sheet to the new merged Spread Sheet */
        spreadSheet.getSheets()[y].copyTo(newSpreadSheet); 
      }
    }      
  }
  </code></pre>
  
  <p>It does create a new sheet but without any csv data.</p>