How to read a csv file with Spout in PHP?

Spout is a PHP library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way.

1. Code:

open($fileInput);
        $count = 1;
        $rows = array();
        foreach ($reader->getSheetIterator() as $sheet) {
            foreach ($sheet->getRowIterator() as $row) {
				$rowAsArray = $row->toArray();
                if ($count > 0) {
					$fileUploadData[] = $rowAsArray;
               }
                $count++;
            }
         echo "successfully uploaded!";
        }
        $reader->close();
    } else {
        echo "PLEASE SELECT A VALID EXCEL FILE";
    }
} else {
    echo "UPLOAD AN EXCEL FILE";
}

?>

2. Example:

Input: example_upload_using_spout.csv

ID	Name	        Description
1	Spout      	Spout is a PHP library to read and write spreadsheet files (CSV, XLSX and ODS)
2	ReaderFactory   This creates an instance of the appropriate reader, given the type of the file to be read

Output:

IDNameDescription
1SpoutSpout is a PHP library to read and write spreadsheet files (CSV, XLSX and ODS)
2ReaderFactoryThis creates an instance of the appropriate reader, given the type of the file to be read