ho trovato una libreria che puo fare al caso mio, https://github.com/nuovo/spreadsheet-reader come faccio a includerla nella funzione?
la funzione tipo che ho postato
vorrei avere come return un eccezione tra file non trovato e file non excel solo xlsx, graziecodice:
- function readastable($sheet){
- $highestrow = $sheet->getHighestRow();
- $highestcolumn = $sheet->getHighestColumn();
- $columncount =PHPExcel_Cell::columnIndexFromString($highestcolumn);
- $titles = $sheet->rangeToArray('A1:'. $highestcolumn ."1");
- $boddy = $sheet->rangeToArray('A2:'. $highestcolumn . $highestrow);
- $table = array();
- for($row =0; $row <= $highestrow -2; $row++){
- $a = array();
- for($column =0; $column <= $columncount -1; $column++){
- $a[$titles[0][$column]]= $boddy[$row][$column];
- }
- $table[$row]= $a;
- }
- return $table;
- }
![]()