Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IOFactory.php
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;
    }
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;
    }
Create Writer\IWriter.

@param Spreadsheet $spreadsheet
@param string $writerType Example: Xlsx

@throws Writer\Exception

@return Writer\IWriter