title: PhpSpreadSheet : Writing to a specific WorkSheet
body: <p>I'm new to PhpSpreadSheet, and I'd like to know if there is a way to load a CSV into a specific WorkSheet ?</p>
  
  <p>I tried the code bellow but it seems to keep loadind the CSVs into the first WorkSheet :/.</p>
  
  <pre><code>&lt;?php
  
  require 'vendor/autoload.php';
  
  use PhpOffice\PhpSpreadsheet\Spreadsheet;
  use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
  use PhpOffice\PhpSpreadsheet\Reader\Csv;
  
  $spreadsheet = new Spreadsheet();
  $spreadsheet-&gt;setActiveSheetIndex(0);
  
  $pathToCsv1 = 'files/csv_files/1.csv';
  $pathToCsv2 = 'files/csv_files/2.csv';
  $pathToCsv3 = 'files/csv_files/3.csv';
  $pathToCsv4 = 'files/csv_files/4.csv';
  
  $aCsvFiles = array($pathToCsv1, $pathToCsv2, $pathToCsv3, $pathToCsv4);
  
  foreach ($aCsvFiles as $index =&gt; $csvFile) {
      $reader = new Csv();
      $reader-&gt;setDelimiter(';');
      $reader-&gt;loadIntoExisting($csvFile, $spreadsheet);
      $workSheet = $spreadsheet-&gt;createSheet();
      $spreadsheet-&gt;setActiveSheetIndex($index + 1);
  }
  
  $writer = new Xlsx($spreadsheet);
  $writer-&gt;save('files/xls_files/all.xlsx');
  </code></pre>
  
  <p>I only get 4.csv in all.xlsx but i have the created WorkSheets</p>
  
  <p><a href="https://i.stack.imgur.com/KxlFd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KxlFd.png" alt="enter image description here"></a></p>