code: public static function createWriter(Spreadsheet $spreadsheet, $writerType)
      {
          if (!isset(self::$writers[$writerType])) {
              throw new Writer\Exception("No writer found for type $writerType");
          }
  
          // Instantiate writer
          $className = self::$writers[$writerType];
          $writer = new $className($spreadsheet);
  
          return $writer;
      }
docs: Create Writer\IWriter.
  
  @param Spreadsheet $spreadsheet
  @param string $writerType Example: Xlsx
  
  @throws Writer\Exception
  
  @return Writer\IWriter