require 'path/to/PHPExcel/Classes/PHPExcel/IOFactory.php'; $inputFileName = 'path/to/file.xlsx'; $reader = PHPExcel_IOFactory::createReaderForFile($inputFileName);
require_once 'vendor/autoload.php'; $inputFileName = 'path/to/file.csv'; $reader = PhpOffice\PhpSpreadsheet\IOFactory::createReaderForFile($inputFileName);This example uses the createReaderForFile method from the PhpOffice\PhpSpreadsheet library to create a reader object for a CSV file with the file name "file.csv". Both examples demonstrate how the createReaderForFile method can be used to create a reader object for a specific type of file. The first example uses the PHPExcel library, while the second example uses the PhpOffice\PhpSpreadsheet library (which is a fork of the PHPExcel library).