0

Well, we can parse csv file to PHP array as follows.

        $arr = [];
        $file = $_FILES['file']['tmp_name'];
        $handle = fopen($file, "r");
        while (($filesop = fgetcsv($handle, 1000, ",")) !== false) {
            $fields = array(
                'col1' => $filesop[0],
                'col2' => $filesop[1],
                'col3' => $filesop[2]
            );
            array_push($arr, $fields);
        }

Similar to above method, Is there any simple direct techniques to parse excel file to array (other than PHPExcel library)? The above code itself creates the array from excel file but data is in encrypted format.

mpsbhat
  • 2,733
  • 12
  • 49
  • 105
  • Possible duplicate of [Excel to PHP array, possible and how?](https://stackoverflow.com/questions/8170525/excel-to-php-array-possible-and-how) – Peon Aug 11 '17 at 10:37
  • Have you tried doing this: `$csv = array_map('str_getcsv', file('data.csv'));` source: http://php.net/manual/en/function.str-getcsv.php#114764 – Shahroze Nawaz Aug 11 '17 at 11:26

0 Answers0